From 3371197594f6207458eb4c28c824eda26d532568 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Tue, 31 Jan 2023 09:35:27 +0100 Subject: [PATCH] Fix issue#32 Error with Fan Modes on thermostat over climate type --- .../versatile_thermostat/climate.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/custom_components/versatile_thermostat/climate.py b/custom_components/versatile_thermostat/climate.py index 2bdbabd..453d1bf 100644 --- a/custom_components/versatile_thermostat/climate.py +++ b/custom_components/versatile_thermostat/climate.py @@ -774,6 +774,50 @@ class VersatileThermostat(ClimateEntity, RestoreEntity): return self._hvac_list + @property + def fan_mode(self) -> str | None: + """Return the fan setting. + + Requires ClimateEntityFeature.FAN_MODE. + """ + if self._is_over_climate and self._underlying_climate: + return self._underlying_climate.fan_mode + + return None + + @property + def fan_modes(self) -> list[str] | None: + """Return the list of available fan modes. + + Requires ClimateEntityFeature.FAN_MODE. + """ + if self._is_over_climate and self._underlying_climate: + return self._underlying_climate.fan_modes + + return [] + + @property + def swing_mode(self) -> str | None: + """Return the swing setting. + + Requires ClimateEntityFeature.SWING_MODE. + """ + if self._is_over_climate and self._underlying_climate: + return self._underlying_climate.swing_mode + + return None + + @property + def swing_modes(self) -> list[str] | None: + """Return the list of available swing modes. + + Requires ClimateEntityFeature.SWING_MODE. + """ + if self._is_over_climate and self._underlying_climate: + return self._underlying_climate.swing_modes + + return None + @property def temperature_unit(self): """Return the unit of measurement."""