Skip to content

Commit

Permalink
πŸ› Avoid early error in water heater
Browse files Browse the repository at this point in the history
Before we received the first mqtt message about target temperature, any
call to update_temperature_bounds leads to a failure.

It's better to not update the temperature bounds and wait for
target_temperature_message.

Fix #234
  • Loading branch information
kamaradclimber committed Jul 30, 2024
1 parent cba75c9 commit 0da4d22
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/aquarea/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ async def async_set_operation_mode(self, operation_mode: str):
await self.async_set_temperature(temperature=float(temp))

def update_temperature_bounds(self) -> None:
self._attr_target_temperature_high = self._attr_target_temperature
self._attr_target_temperature_low = (
self._heat_delta + self._attr_target_temperature
)
if self._attr_target_temperature is not None:
self._attr_target_temperature_high = self._attr_target_temperature
self._attr_target_temperature_low = (
self._heat_delta + self._attr_target_temperature
)

async def async_added_to_hass(self) -> None:
"""Subscribe to MQTT events."""
Expand Down

0 comments on commit 0da4d22

Please sign in to comment.