Skip to content

Commit

Permalink
Fix type conversion after templates
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Jan 15, 2024
1 parent f035890 commit 42ad91d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion custom_components/yandex_station/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ async def async_added_to_hass(self):
self.async_on_remove(on_remove)

def on_track_template(self, value):
self._attr_current_temperature = value
try:
self._attr_current_temperature = float(value)
except:
self._attr_current_temperature = None
self._async_write_ha_state()

async def async_set_hvac_mode(self, hvac_mode: HVACMode):
Expand Down
5 changes: 4 additions & 1 deletion custom_components/yandex_station/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ async def async_added_to_hass(self):
self.async_on_remove(on_remove)

def on_track_template(self, value):
self._attr_current_humidity = value
try:
self._attr_current_humidity = int(value)
except:
self._attr_current_humidity = None
self._async_write_ha_state()

async def async_set_humidity(self, humidity: int) -> None:
Expand Down

0 comments on commit 42ad91d

Please sign in to comment.