From 214188b0be844ae823725cb4833898ef0950773d Mon Sep 17 00:00:00 2001 From: Stefano Pierini Date: Sat, 17 Oct 2026 10:51:44 +0200 Subject: [PATCH] fix(climate): push setpoint to connected thermostat and support climate entities in sensor float conversion --- custom_components/sat/climate.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/custom_components/sat/climate.py b/custom_components/sat/climate.py index 2c324543..17299cf3 100644 --- a/custom_components/sat/climate.py +++ b/custom_components/sat/climate.py @@ -652,8 +652,11 @@ async def async_set_target_temperature(self, temperature: float, cascade: bool = data = {ATTR_ENTITY_ID: entity_id, ATTR_TEMPERATURE: temperature} await self.hass.services.async_call(CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, data, blocking=True) - # Set the target temperature for the connected boiler + # Set the target temperature for the connected boiler / thermostat if self._config.push_setpoint_to_thermostat: + if self._config.thermostat is not None: + data = {ATTR_ENTITY_ID: self._config.thermostat, ATTR_TEMPERATURE: temperature} + await self.hass.services.async_call(CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, data) await self._coordinator.async_set_control_thermostat_setpoint(temperature) # Reset the climate @@ -683,7 +686,17 @@ def _get_entity_state_float(self, entity_id: str) -> Optional[float]: if entity.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]: return None - return float(entity.state) + if entity.domain == "climate" or "current_temperature" in entity.attributes: + if (curr_temp := entity.attributes.get("current_temperature")) is not None: + try: + return float(curr_temp) + except (ValueError, TypeError): + pass + + try: + return float(entity.state) + except (ValueError, TypeError): + return None def _update_heating_curves(self) -> None: """Update the heating curves based on the current outside temperature."""