diff --git a/custom_components/nordpool_planner/__init__.py b/custom_components/nordpool_planner/__init__.py index b86b5e2..cee521c 100644 --- a/custom_components/nordpool_planner/__init__.py +++ b/custom_components/nordpool_planner/__init__.py @@ -27,6 +27,7 @@ CONF_ACCEPT_RATE_ENTITY, CONF_DURATION_ENTITY, CONF_END_TIME_ENTITY, + CONF_HEALTH_ENTITY, CONF_PRICES_ENTITY, CONF_SEARCH_LENGTH_ENTITY, CONF_START_TIME_ENTITY, @@ -141,6 +142,8 @@ def data_21_to_22(data: dict): if data[CONF_TYPE] == CONF_TYPE_STATIC: data[CONF_USED_HOURS_LOW_ENTITY] = True data[CONF_START_TIME_ENTITY] = True + if CONF_HEALTH_ENTITY not in data: + data[CONF_HEALTH_ENTITY] = True return data if config_entry.version == 1: diff --git a/custom_components/nordpool_planner/config_flow.py b/custom_components/nordpool_planner/config_flow.py index daa61f2..cdbba32 100644 --- a/custom_components/nordpool_planner/config_flow.py +++ b/custom_components/nordpool_planner/config_flow.py @@ -17,6 +17,7 @@ CONF_ACCEPT_RATE_ENTITY, CONF_DURATION_ENTITY, CONF_END_TIME_ENTITY, + CONF_HEALTH_ENTITY, CONF_HIGH_COST_ENTITY, CONF_LOW_COST_ENTITY, CONF_PRICES_ENTITY, @@ -111,6 +112,7 @@ async def async_step_user( vol.Required(CONF_ACCEPT_RATE_ENTITY, default=False): bool, vol.Required(CONF_HIGH_COST_ENTITY, default=False): bool, vol.Required(CONF_STARTS_AT_ENTITY, default=False): bool, + vol.Required(CONF_HEALTH_ENTITY, default=True): bool, } ) diff --git a/custom_components/nordpool_planner/sensor.py b/custom_components/nordpool_planner/sensor.py index fa7a178..5b7e552 100644 --- a/custom_components/nordpool_planner/sensor.py +++ b/custom_components/nordpool_planner/sensor.py @@ -91,8 +91,7 @@ async def async_setup_entry( ) ) - # if config_entry.data.get(CONF_HEALTH_ENTITY): - if True: + if config_entry.data.get(CONF_HEALTH_ENTITY): entities.append( NordpoolPlannerHealthSensor( planner, diff --git a/custom_components/nordpool_planner/translations/en.json b/custom_components/nordpool_planner/translations/en.json index 5fe6c5e..fa6f5ff 100644 --- a/custom_components/nordpool_planner/translations/en.json +++ b/custom_components/nordpool_planner/translations/en.json @@ -13,7 +13,8 @@ "accept_cost_entity": "Accept cost: Creates a configuration parameter that turn on if cost below", "accept_rate_entity": "Accept rate: Creates a configuration parameter that turn on if cost-rate to daily average below", "high_cost_entity": "High cost: Creates a binary sensor that tell in it's the highest cost (inverse of normal)", - "starts_at_entity": "Starts at: Creates additional sensors telling when next lowest and highest cost starts" + "starts_at_entity": "Starts at: Creates additional sensors telling when next lowest and highest cost starts", + "health_entity": "Adds a status entity to tell overall health of planner" } } },