Skip to content

Commit

Permalink
Fixes an issue where setting 0 as a temperature modifier wasn't updat…
Browse files Browse the repository at this point in the history
…ing the target temperature (#26)
  • Loading branch information
cjaliaga authored Sep 26, 2022
1 parent 7954596 commit b6fe114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions custom_components/aquarea/climate.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"""Climate entity to control a zone for a Panasonic Aquarea Device"""
from __future__ import annotations

import logging

from aioaquarea import (
DeviceAction,
ExtendedOperationMode,
UpdateOperationMode,
OperationStatus,
UpdateOperationMode,
)

from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
Expand Down Expand Up @@ -183,9 +185,9 @@ async def async_set_hvac_mode(self, hvac_mode):
async def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature if supported by the zone"""
zone = self.coordinator.device.zones.get(self._zone_id)
temperature = kwargs.get(ATTR_TEMPERATURE, None)
temperature: float | None = kwargs.get(ATTR_TEMPERATURE)

if temperature and zone.supports_set_temperature:
if temperature is not None and zone.supports_set_temperature:
_LOGGER.debug(
"Setting temperature of device:zone == %s:%s to %s",
self.coordinator.device.device_id,
Expand Down
3 changes: 2 additions & 1 deletion custom_components/aquarea/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def _update_temperature(self) -> None:

async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
if temperature := kwargs.get(ATTR_TEMPERATURE):
temperature: float | None = kwargs.get(ATTR_TEMPERATURE)
if temperature is not None:
_LOGGER.debug(
"Setting %s water tank temperature to %s",
self.coordinator.device.device_id,
Expand Down

0 comments on commit b6fe114

Please sign in to comment.