Skip to content

Commit

Permalink
added initial load for climate
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Feb 15, 2024
1 parent 5263209 commit 038b6a6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions custom_components/eltako/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,16 @@ def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpres


def load_value_initially(self, latest_state:State):
LOGGER.warn(f"[climate {self.dev_id}] Load value initially not yet implemented!!!")
LOGGER.debug(f"[climate {self.dev_id}] eneity unique_id: {self.unique_id}")
LOGGER.debug(f"[climate {self.dev_id}] latest state - state: {latest_state.state}")
LOGGER.debug(f"[climate {self.dev_id}] latest state - attributes: {latest_state.attributes}")
# LOGGER.debug(f"[climate {self.dev_id}] eneity unique_id: {self.unique_id}")
# LOGGER.debug(f"[climate {self.dev_id}] latest state - state: {latest_state.state}")
# LOGGER.debug(f"[climate {self.dev_id}] latest state - attributes: {latest_state.attributes}")

try:
# self.hvac_modes = []
# for m_str in latest_state.attributes.get('hvac_modes', []):
# for m_enum in HVACMode:
# if m_str == m_enum.value:
# self.hvac_modes.append(m_enum)
self.hvac_modes = []
for m_str in latest_state.attributes.get('hvac_modes', []):
for m_enum in HVACMode:
if m_str == m_enum.value:
self.hvac_modes.append(m_enum)

self._attr_current_temperature = float(latest_state.attributes.get('current_temperature', None) )
self._attr_target_temperature = float(latest_state.attributes.get('temperature', None) )
Expand All @@ -171,6 +170,8 @@ def load_value_initially(self, latest_state:State):

except Exception as e:
self._attr_hvac_mode = None
self._attr_current_temperature = None
self._attr_target_temperature = None
raise e

self.schedule_update_ha_state()
Expand Down

0 comments on commit 038b6a6

Please sign in to comment.