Skip to content

Commit adb2107

Browse files
authored
Merge pull request #570 from plugwise/fix-569
Fix for Core PR #109464
2 parents e046d30 + 0dbc372 commit adb2107

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

custom_components/plugwise/climate.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def __init__(
7777
"""Set up the Plugwise API."""
7878
super().__init__(coordinator, device_id)
7979

80+
self._homekit_enabled = homekit_enabled # pw-beta homekit emulation
81+
gateway_id: str = coordinator.data.gateway["gateway_id"]
82+
self.gateway_data = coordinator.data.devices[gateway_id]
83+
8084
self._attr_max_temp = min(self.device["thermostat"]["upper_bound"], 35.0)
8185
self._attr_min_temp = self.device["thermostat"]["lower_bound"]
8286
# Ensure we don't drop below 0.1
@@ -88,28 +92,21 @@ def __init__(
8892
# Determine supported features
8993
self.cdr_gateway = coordinator.data.gateway
9094
self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
91-
if HVACMode.OFF in self.hvac_modes:
92-
self._attr_supported_features |= (
93-
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
94-
)
95-
9695
if (
9796
self.cdr_gateway["cooling_present"]
9897
and self.cdr_gateway["smile_name"] != "Adam"
9998
):
10099
self._attr_supported_features = (
101100
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
102101
)
102+
if HVACMode.OFF in self.hvac_modes:
103+
self._attr_supported_features |= (
104+
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
105+
)
103106
if presets := self.device.get("preset_modes"):
104107
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
105108
self._attr_preset_modes = presets
106109

107-
# Determine stable hvac_modes
108-
self._homekit_enabled = homekit_enabled # pw-beta homekit emulation
109-
gateway_id: str = coordinator.data.gateway["gateway_id"]
110-
self.gateway_data = coordinator.data.devices[gateway_id]
111-
self._hvac_modes: list[HVACMode] = []
112-
113110
def _previous_action_mode(self, coordinator: PlugwiseDataUpdateCoordinator) -> None:
114111
"""Return the previous action-mode when the regulation-mode is not heating or cooling.
115112

0 commit comments

Comments
 (0)