Skip to content

Commit

Permalink
Fix errors in HitachiDHW in Overkiz (#133765)
Browse files Browse the repository at this point in the history
* Small changes to fix errors in DHW

* Update

* Bugfix in float/int mistake

* Fix typing

* Fix code style

* Fix mypy
  • Loading branch information
iMicknl authored Dec 22, 2024
1 parent cdd73a5 commit 56b58ce
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions homeassistant/components/overkiz/water_heater/hitachi_dhw.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ class HitachiDHW(OverkizEntity, WaterHeaterEntity):
def current_temperature(self) -> float | None:
"""Return the current temperature."""
current_temperature = self.device.states[OverkizState.CORE_DHW_TEMPERATURE]
if current_temperature:
return current_temperature.value_as_float

if current_temperature and current_temperature.value_as_int:
return float(current_temperature.value_as_int)

return None

@property
Expand All @@ -58,13 +60,14 @@ def target_temperature(self) -> float | None:
target_temperature = self.device.states[
OverkizState.MODBUS_CONTROL_DHW_SETTING_TEMPERATURE
]
if target_temperature:
return target_temperature.value_as_float

if target_temperature and target_temperature.value_as_int:
return float(target_temperature.value_as_int)

return None

async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature."""

await self.executor.async_execute_command(
OverkizCommand.SET_CONTROL_DHW_SETTING_TEMPERATURE,
int(kwargs[ATTR_TEMPERATURE]),
Expand Down

0 comments on commit 56b58ce

Please sign in to comment.