From d5f9d3c381a20c492605f5cef683b5f0a5168846 Mon Sep 17 00:00:00 2001 From: Alex X Date: Thu, 4 Apr 2024 07:31:56 +0300 Subject: [PATCH] Fix ClimateEntityFeature warning #459 --- custom_components/yandex_station/climate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/custom_components/yandex_station/climate.py b/custom_components/yandex_station/climate.py index bdbdca7..4090919 100644 --- a/custom_components/yandex_station/climate.py +++ b/custom_components/yandex_station/climate.py @@ -5,7 +5,7 @@ ClimateEntityFeature, HVACMode, ) -from homeassistant.const import UnitOfTemperature +from homeassistant.const import MAJOR_VERSION, MINOR_VERSION, UnitOfTemperature from .core import utils from .core.entity import YandexEntity @@ -43,6 +43,13 @@ class YandexClimate(ClimateEntity, YandexEntity): on_value: bool = None hvac_value: str = None + # https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded + if (MAJOR_VERSION, MINOR_VERSION) >= (2024, 2): + _attr_supported_features = ( + ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF + ) + _enable_turn_on_off_backwards_compatibility = False + def internal_init(self, capabilities: dict, properties: dict): # instance candidates for hvac and preset modes candidates = ["thermostat", "program", "heat", "work_speed"]