Skip to content

Commit bf778a8

Browse files
authored
Fixes deprecation warnings in HA 2024.2.x (#74)
* 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. * 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 * Bump version and update readme Bumped version and updated README with logger information (it was not straightforward to figure out both settings)
1 parent cd817c5 commit bf778a8

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,17 @@ If you are winding up having to do multiple restarts because Home Assistant won'
128128

129129
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`
130130

131+
#### Debugging flags
131132

133+
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.
134+
135+
```
136+
logger:
137+
default: warning
138+
logs:
139+
custom_components.warmup.climate: debug
140+
custom_components.warmup.warmup4ie.warmup4ie: debug
141+
```
132142
### Add your devices to the dashboard
133143
134144
Our wiki has some [ideas on how to configure warmup

custom_components/warmup/climate.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
CONF_USERNAME,
2323
PRECISION_HALVES,
2424
UnitOfTemperature,
25+
MAJOR_VERSION,
26+
MINOR_VERSION,
2527
)
28+
2629
from homeassistant.exceptions import InvalidStateError, PlatformNotReady
2730
import homeassistant.helpers.config_validation as cv
2831
from homeassistant.util import Throttle
@@ -67,7 +70,7 @@
6770
CONST_MODE_OFF: HVACMode.OFF,
6871
}
6972

70-
SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
73+
SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TURN_ON |ClimateEntityFeature.TURN_OFF
7174
SUPPORT_HVAC_HEAT = [HVACMode.HEAT, HVACMode.AUTO, HVACMode.OFF]
7275
SUPPORT_PRESET = [PRESET_AWAY, PRESET_HOME, PRESET_BOOST]
7376

@@ -152,6 +155,9 @@ def __init__(self, hass, device: Warmup4IEDevice, client: WarmupClient):
152155
self._away = False
153156
self._on = True
154157

158+
# https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded
159+
self._enable_turn_on_off_backwards_compatibility = False
160+
155161
@property
156162
def name(self):
157163
"""Return the name of the climate device."""
@@ -250,6 +256,14 @@ def set_hvac_mode(self, hvac_mode):
250256
else:
251257
raise InvalidStateError
252258

259+
def turn_on(self) -> None:
260+
"""Turn the entity on."""
261+
self.set_hvac_mode(HVACMode.AUTO)
262+
263+
def turn_off(self) -> None:
264+
"""Turn the entity off."""
265+
self.set_hvac_mode(HVACMode.OFF)
266+
253267
def set_override(self, temperature, until):
254268
"""Set a temperature override for this thermostat."""
255269
self._device.set_override(temperature, until)

custom_components/warmup/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "cloud_polling",
99
"issue_tracker": "https://github.com/ha-warmup/warmup/issues/",
1010
"requirements": [],
11-
"version": "2024.2.7"
11+
"version": "2024.2.8"
1212
}

0 commit comments

Comments
 (0)