Skip to content

Commit

Permalink
Fix ClimateEntityFeature warning #459
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 4, 2024
1 parent dbd57dc commit d5f9d3c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/yandex_station/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit d5f9d3c

Please sign in to comment.