From 7c64101804022ea7065356578c75157055eb4fea Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Sun, 11 Feb 2024 14:48:24 -0800 Subject: [PATCH 1/3] First pass at trying to fix TURN_OFF and TURN_ON compatibility from 2024.2 Implementing new TURN_OFF, TURN_ON feature flags to squelch warnings in 2024.2 forward. Still struggling with the async_turn_on and off calls. They don't work. I.e. calling home assistant generic turn on/off on a warmup climate object. --- custom_components/warmup/climate.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/custom_components/warmup/climate.py b/custom_components/warmup/climate.py index ac049ca..4c4a464 100644 --- a/custom_components/warmup/climate.py +++ b/custom_components/warmup/climate.py @@ -67,7 +67,7 @@ CONST_MODE_OFF: HVACMode.OFF, } -SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE +SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TURN_ON |ClimateEntityFeature.TURN_OFF SUPPORT_HVAC_HEAT = [HVACMode.HEAT, HVACMode.AUTO, HVACMode.OFF] SUPPORT_PRESET = [PRESET_AWAY, PRESET_HOME, PRESET_BOOST] @@ -151,6 +151,9 @@ def __init__(self, hass, device: Warmup4IEDevice, client: WarmupClient): self._current_operation_mode = device.run_mode self._away = False self._on = True + # 2024.2 warned about this, we don't need it anymore + self._enable_turn_on_off_backwards_compatibility = False + @property def name(self): @@ -167,6 +170,26 @@ def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temperature + @property + def turn_on(self) -> None: + """Turn the entity on.""" + self.set_hvac_mode(HVACMode.AUTO) + + @property + async def async_turn_on(self) -> None: + """Turn the entity on, which means AUTO for us.""" + await self.hass.async_add_executor_job(self.set_hvac_mode, HVACMode.AUTO) + + @property + def turn_off(self) -> None: + """Turn the entity off.""" + self.set_hvac_mode(HVACMode.OFF) + + @property + async def async_turn_off(self) -> None: + """Turn the entity off.""" + await self.hass.async_add_executor_job(self.set_hvac_mode, HVACMode.OFF) + @property def hvac_mode(self): """Return hvac operation ie. heat, cool mode. From 30f87a34ba37fd9934c4c58ffab61dc06aee857d Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Sun, 18 Feb 2024 16:22:22 -0800 Subject: [PATCH 2/3] First pass at supporting new turn off/on Supported the new flags to quell warnings from HA after https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded --- custom_components/warmup/climate.py | 35 +++++++++++------------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/custom_components/warmup/climate.py b/custom_components/warmup/climate.py index 4c4a464..f164372 100644 --- a/custom_components/warmup/climate.py +++ b/custom_components/warmup/climate.py @@ -22,7 +22,10 @@ CONF_USERNAME, PRECISION_HALVES, UnitOfTemperature, + MAJOR_VERSION, + MINOR_VERSION, ) + from homeassistant.exceptions import InvalidStateError, PlatformNotReady import homeassistant.helpers.config_validation as cv from homeassistant.util import Throttle @@ -151,9 +154,9 @@ def __init__(self, hass, device: Warmup4IEDevice, client: WarmupClient): self._current_operation_mode = device.run_mode self._away = False self._on = True - # 2024.2 warned about this, we don't need it anymore + + # https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded self._enable_turn_on_off_backwards_compatibility = False - @property def name(self): @@ -170,26 +173,6 @@ def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temperature - @property - def turn_on(self) -> None: - """Turn the entity on.""" - self.set_hvac_mode(HVACMode.AUTO) - - @property - async def async_turn_on(self) -> None: - """Turn the entity on, which means AUTO for us.""" - await self.hass.async_add_executor_job(self.set_hvac_mode, HVACMode.AUTO) - - @property - def turn_off(self) -> None: - """Turn the entity off.""" - self.set_hvac_mode(HVACMode.OFF) - - @property - async def async_turn_off(self) -> None: - """Turn the entity off.""" - await self.hass.async_add_executor_job(self.set_hvac_mode, HVACMode.OFF) - @property def hvac_mode(self): """Return hvac operation ie. heat, cool mode. @@ -273,6 +256,14 @@ def set_hvac_mode(self, hvac_mode): else: raise InvalidStateError + def turn_on(self) -> None: + """Turn the entity on.""" + self.set_hvac_mode(HVACMode.AUTO) + + def turn_off(self) -> None: + """Turn the entity off.""" + self.set_hvac_mode(HVACMode.OFF) + def set_override(self, temperature, until): """Set a temperature override for this thermostat.""" self._device.set_override(temperature, until) From a4a1ca8cea84e0f87758595e2137cd502648f63b Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Wed, 21 Feb 2024 14:21:23 -0800 Subject: [PATCH 3/3] Bump version and update readme Bumped version and updated README with logger information (it was not straightforward to figure out both settings) --- README.md | 10 ++++++++++ custom_components/warmup/manifest.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d80f62a..a89db76 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,17 @@ If you are winding up having to do multiple restarts because Home Assistant won' Alternatively, with the menu restructuring, the menu entry for _Stop Server_ isn't accessible. However you can use the keyboard short cut 'c' and type restart to find that choice. Once the server has stopped you can move the config entry in and do a `ha core start` +#### Debugging flags +If you do encounter issues, here are the logger settings in the Home Assistant configuration file you use to set debug or other levels of logging. + +``` +logger: + default: warning + logs: + custom_components.warmup.climate: debug + custom_components.warmup.warmup4ie.warmup4ie: debug +``` ### Add your devices to the dashboard Our wiki has some [ideas on how to configure warmup diff --git a/custom_components/warmup/manifest.json b/custom_components/warmup/manifest.json index 8fadc2b..6eb46f2 100644 --- a/custom_components/warmup/manifest.json +++ b/custom_components/warmup/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/ha-warmup/warmup/issues/", "requirements": [], - "version": "2024.2.7" + "version": "2024.2.8" }