From 038b6a6c4b35b6893181602c5fe305ab5b978d15 Mon Sep 17 00:00:00 2001 From: Philipp Grimm Date: Fri, 16 Feb 2024 00:54:18 +0100 Subject: [PATCH] added initial load for climate --- custom_components/eltako/climate.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/custom_components/eltako/climate.py b/custom_components/eltako/climate.py index e164d2a..cdb66a9 100644 --- a/custom_components/eltako/climate.py +++ b/custom_components/eltako/climate.py @@ -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) ) @@ -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()