From b0f80ca052d93cb44fe3031d12c9eec1add0eb1f Mon Sep 17 00:00:00 2001 From: davmapo <96447423+davmapo@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:41:50 +0100 Subject: [PATCH 1/4] Improve HVAC action detection and event handling Enhanced climate entity logic to better determine HVAC actions based on current mode and message state. Added explicit handling for OWNHeatingEvent with dimension 20 in gateway to ensure climate entities update their state promptly. --- custom_components/myhome/climate.py | 8 ++++---- custom_components/myhome/gateway.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/custom_components/myhome/climate.py b/custom_components/myhome/climate.py index c5a4839..1588d6b 100644 --- a/custom_components/myhome/climate.py +++ b/custom_components/myhome/climate.py @@ -419,13 +419,13 @@ def handle_event(self, message: OWNHeatingEvent): ) if message.is_active(): if self._heating and self._cooling: - if message.is_heating(): + if message.is_heating() or self._attr_hvac_mode == HVACMode.HEAT: self._attr_hvac_action = HVACAction.HEATING - elif message.is_cooling(): + elif message.is_cooling() or self._attr_hvac_mode == HVACMode.COOL: self._attr_hvac_action = HVACAction.COOLING - elif self._heating: + elif self._heating or self._attr_hvac_mode == HVACMode.HEAT: self._attr_hvac_action = HVACAction.HEATING - elif self._cooling: + elif self._cooling or self._attr_hvac_mode == HVACMode.COOL: self._attr_hvac_action = HVACAction.COOLING elif self._attr_hvac_mode == HVACMode.OFF: self._attr_hvac_action = HVACAction.OFF diff --git a/custom_components/myhome/gateway.py b/custom_components/myhome/gateway.py index 821a20d..2d6bc4f 100644 --- a/custom_components/myhome/gateway.py +++ b/custom_components/myhome/gateway.py @@ -281,6 +281,9 @@ async def listening_loop(self): ) ): self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][_platform][message.entity][CONF_ENTITIES][_entity].handle_event(message) + if isinstance(message, OWNHeatingEvent) and message.dimension == 20: + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].handle_event(message) + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].async_schedule_update_ha_state() else: LOGGER.debug( From 074296da26c1df6703b5f0b51b717a48377ee822 Mon Sep 17 00:00:00 2001 From: davmapo <96447423+davmapo@users.noreply.github.com> Date: Thu, 11 Dec 2025 21:06:04 +0100 Subject: [PATCH 2/4] Handle OWNHeatingEvent only for non-zero 'where' Added a check to process OWNHeatingEvent messages with dimension 20 only when 'where' is not zero. This prevents unnecessary event handling and state updates for messages with 'where' equal to zero. --- custom_components/myhome/gateway.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/myhome/gateway.py b/custom_components/myhome/gateway.py index 2d6bc4f..29ddf2f 100644 --- a/custom_components/myhome/gateway.py +++ b/custom_components/myhome/gateway.py @@ -282,8 +282,10 @@ async def listening_loop(self): ): self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][_platform][message.entity][CONF_ENTITIES][_entity].handle_event(message) if isinstance(message, OWNHeatingEvent) and message.dimension == 20: - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].handle_event(message) - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].async_schedule_update_ha_state() + + if message.where != 0: + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].handle_event(message) + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].async_schedule_update_ha_state() else: LOGGER.debug( From ea78c317deacad6f71e46d74fbd4773c15c37555 Mon Sep 17 00:00:00 2001 From: davmapo <96447423+davmapo@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:18:22 +0100 Subject: [PATCH 3/4] Refine handling of heating events in climate integration Updated climate.py to only set HVAC action when message is active and 'where' is not '0'. Removed redundant 'where' check in gateway.py for OWNHeatingEvent, ensuring all such events are processed regardless of 'where' value. --- custom_components/myhome/climate.py | 2 +- custom_components/myhome/gateway.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/custom_components/myhome/climate.py b/custom_components/myhome/climate.py index 1588d6b..5b875a5 100644 --- a/custom_components/myhome/climate.py +++ b/custom_components/myhome/climate.py @@ -417,7 +417,7 @@ def handle_event(self, message: OWNHeatingEvent): self._gateway_handler.log_id, message.human_readable_log, ) - if message.is_active(): + if message.is_active() and message.where != "0": if self._heating and self._cooling: if message.is_heating() or self._attr_hvac_mode == HVACMode.HEAT: self._attr_hvac_action = HVACAction.HEATING diff --git a/custom_components/myhome/gateway.py b/custom_components/myhome/gateway.py index 29ddf2f..2d6bc4f 100644 --- a/custom_components/myhome/gateway.py +++ b/custom_components/myhome/gateway.py @@ -282,10 +282,8 @@ async def listening_loop(self): ): self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][_platform][message.entity][CONF_ENTITIES][_entity].handle_event(message) if isinstance(message, OWNHeatingEvent) and message.dimension == 20: - - if message.where != 0: - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].handle_event(message) - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].async_schedule_update_ha_state() + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].handle_event(message) + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][CLIMATE][message.entity][CONF_ENTITIES][_entity].async_schedule_update_ha_state() else: LOGGER.debug( From 454c38a0bc66e446a8fa392f8f2ddcdac814b5ae Mon Sep 17 00:00:00 2001 From: davmapo Date: Fri, 26 Dec 2025 16:27:06 +0100 Subject: [PATCH 4/4] Refactor HVAC action logic in climate entity If where 0 and dimesnion 20, do not change HVAC action, because where 0 is not a single thermostat --- custom_components/myhome/climate.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/custom_components/myhome/climate.py b/custom_components/myhome/climate.py index 5b875a5..aa0e383 100644 --- a/custom_components/myhome/climate.py +++ b/custom_components/myhome/climate.py @@ -417,19 +417,20 @@ def handle_event(self, message: OWNHeatingEvent): self._gateway_handler.log_id, message.human_readable_log, ) - if message.is_active() and message.where != "0": - if self._heating and self._cooling: - if message.is_heating() or self._attr_hvac_mode == HVACMode.HEAT: + if message.where != "0": + if message.is_active(): + if self._heating and self._cooling: + if message.is_heating() or self._attr_hvac_mode == HVACMode.HEAT: + self._attr_hvac_action = HVACAction.HEATING + elif message.is_cooling() or self._attr_hvac_mode == HVACMode.COOL: + self._attr_hvac_action = HVACAction.COOLING + elif self._heating or self._attr_hvac_mode == HVACMode.HEAT: self._attr_hvac_action = HVACAction.HEATING - elif message.is_cooling() or self._attr_hvac_mode == HVACMode.COOL: + elif self._cooling or self._attr_hvac_mode == HVACMode.COOL: self._attr_hvac_action = HVACAction.COOLING - elif self._heating or self._attr_hvac_mode == HVACMode.HEAT: - self._attr_hvac_action = HVACAction.HEATING - elif self._cooling or self._attr_hvac_mode == HVACMode.COOL: - self._attr_hvac_action = HVACAction.COOLING - elif self._attr_hvac_mode == HVACMode.OFF: - self._attr_hvac_action = HVACAction.OFF - else: - self._attr_hvac_action = HVACAction.IDLE + elif self._attr_hvac_mode == HVACMode.OFF: + self._attr_hvac_action = HVACAction.OFF + else: + self._attr_hvac_action = HVACAction.IDLE self.async_schedule_update_ha_state()