Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings on initialization #24

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions custom_components/wundasmart/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CONF_HOST,
CONF_USERNAME,
CONF_PASSWORD,
TEMP_CELSIUS,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -89,7 +89,7 @@ class Device(CoordinatorEntity[WundasmartDataUpdateCoordinator], ClimateEntity):
"""Representation of an Wundasmart climate."""

_attr_hvac_modes = SUPPORTED_HVAC_MODES
_attr_temperature_unit = TEMP_CELSIUS
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_preset_modes = SUPPORTED_PRESET_MODES
_attr_translation_key = DOMAIN

Expand All @@ -113,8 +113,15 @@ def __init__(
self._attr_unique_id = device["id"]
self._attr_type = device["device_type"]
self._attr_device_info = coordinator.device_info
# This flag needs to be set until 2025.1 to prevent warnings about
# implicitly supporting the turn_off/turn_on methods.
# https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded/
self._enable_turn_on_off_backwards_compatibility = False
self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.PRESET_MODE
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TURN_ON
)
self._attr_current_temperature = None
self._attr_target_temperature = None
Expand Down
4 changes: 2 additions & 2 deletions custom_components/wundasmart/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
CONF_HOST,
CONF_USERNAME,
CONF_PASSWORD,
TEMP_CELSIUS,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import aiohttp_client, entity_platform
Expand Down Expand Up @@ -124,7 +124,7 @@ class Device(CoordinatorEntity[WundasmartDataUpdateCoordinator], WaterHeaterEnti

_attr_operation_list = list(sorted({ OPERATION_SET_AUTO } | HW_BOOST_OPERATIONS | HW_OFF_OPERATIONS, key=_split_operation))
_attr_supported_features = WaterHeaterEntityFeature.OPERATION_MODE
_attr_temperature_unit = TEMP_CELSIUS
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_translation_key = DOMAIN

def __init__(
Expand Down