Skip to content

Commit

Permalink
fix: Fixed charge limit sensor to behave like the app around accepted…
Browse files Browse the repository at this point in the history
… values
  • Loading branch information
BottlecapDave committed Feb 7, 2024
1 parent 419653b commit c42a619
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/octopus_energy/intelligent/charge_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __init__(self, hass: HomeAssistant, coordinator, client: OctopusEnergyApiCli
self._attributes = {}
self.entity_id = generate_entity_id("number.{}", self.unique_id, hass=hass)

self._attr_native_min_value = 10
self._attr_native_max_value = 100
self._attr_native_step = 5

@property
def unique_id(self):
"""The id of the sensor."""
Expand Down Expand Up @@ -105,7 +109,7 @@ async def async_added_to_hass(self) -> None:
(last_number_data := await self.async_get_last_number_data())
):

self._attributes = dict_to_typed_dict(last_state.attributes)
self._attributes = dict_to_typed_dict(last_state.attributes, ["min", "max", "step"])
if last_state.state not in (STATE_UNAVAILABLE, STATE_UNKNOWN):
self._state = last_number_data.native_value

Expand Down

0 comments on commit c42a619

Please sign in to comment.