Fix Matter climate platform attributes when dedicated OnOff attribute is off (#126286)

This commit is contained in:
Marcel van der Veldt 2024-09-23 09:27:11 +02:00 committed by Franck Nijhof
parent 7658ed8eaa
commit 2322d071e4
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -190,11 +190,12 @@ class MatterClimate(MatterEntity, ClimateEntity):
# if the mains power is off - treat it as if the HVAC mode is off # if the mains power is off - treat it as if the HVAC mode is off
self._attr_hvac_mode = HVACMode.OFF self._attr_hvac_mode = HVACMode.OFF
self._attr_hvac_action = None self._attr_hvac_action = None
return else:
# update hvac_mode from SystemMode # update hvac_mode from SystemMode
system_mode_value = int( system_mode_value = int(
self.get_matter_attribute_value(clusters.Thermostat.Attributes.SystemMode) self.get_matter_attribute_value(
clusters.Thermostat.Attributes.SystemMode
)
) )
match system_mode_value: match system_mode_value:
case SystemModeEnum.kAuto: case SystemModeEnum.kAuto:
@ -220,9 +221,15 @@ class MatterClimate(MatterEntity, ClimateEntity):
clusters.Thermostat.Attributes.ThermostatRunningState clusters.Thermostat.Attributes.ThermostatRunningState
): ):
match running_state_value: match running_state_value:
case ThermostatRunningState.Heat | ThermostatRunningState.HeatStage2: case (
ThermostatRunningState.Heat
| ThermostatRunningState.HeatStage2
):
self._attr_hvac_action = HVACAction.HEATING self._attr_hvac_action = HVACAction.HEATING
case ThermostatRunningState.Cool | ThermostatRunningState.CoolStage2: case (
ThermostatRunningState.Cool
| ThermostatRunningState.CoolStage2
):
self._attr_hvac_action = HVACAction.COOLING self._attr_hvac_action = HVACAction.COOLING
case ( case (
ThermostatRunningState.Fan ThermostatRunningState.Fan
@ -232,6 +239,7 @@ class MatterClimate(MatterEntity, ClimateEntity):
self._attr_hvac_action = HVACAction.FAN self._attr_hvac_action = HVACAction.FAN
case _: case _:
self._attr_hvac_action = HVACAction.OFF self._attr_hvac_action = HVACAction.OFF
# update target temperature high/low # update target temperature high/low
supports_range = ( supports_range = (
self._attr_supported_features self._attr_supported_features