Skip to content

Commit

Permalink
Add config for planner_health sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
dala318 committed Dec 20, 2024
1 parent db9f023 commit e30fbb9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions custom_components/nordpool_planner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions custom_components/nordpool_planner/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
)

Expand Down
3 changes: 1 addition & 2 deletions custom_components/nordpool_planner/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion custom_components/nordpool_planner/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down

0 comments on commit e30fbb9

Please sign in to comment.