Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status entity again due to lost in rebase #77

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add config for planner_health sensor
  • Loading branch information
dala318 committed Dec 20, 2024
commit 1eb49de0af6cc33abe8b5f3649154e1342f5e557
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