Skip to content

Commit

Permalink
Set _attr_temperature_unit for HA temperature conversion
Browse files Browse the repository at this point in the history
Meybee fixes #107
  • Loading branch information
nao-pon committed Jun 9, 2024
1 parent 3dddb93 commit 165ea9f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
STATE_OFF,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
UnitOfTemperature,
)

from .const import (
Expand Down Expand Up @@ -546,6 +547,13 @@ def __init__(
path = self.topic.split("/")
self.availability_topic = "tele/" + path[1] + "/LWT"

# Set _attr_*
self._attr_temperature_unit = (
UnitOfTemperature.CELSIUS
if self._celsius.lower() == "on"
else UnitOfTemperature.FAHRENHEIT
)

async def async_added_to_hass(self):
# Replacing `async_track_state_change` with `async_track_state_change_event`
# See, https://developers.home-assistant.io/blog/2024/04/13/deprecate_async_track_state_change/
Expand Down

0 comments on commit 165ea9f

Please sign in to comment.