mirror of
https://github.com/home-assistant/core.git
synced 2026-02-15 07:36:16 +00:00
Remove deprecated extra attributes from fritzbox climate (#154152)
This commit is contained in:
@@ -13,27 +13,14 @@ from homeassistant.components.climate import (
|
||||
ClimateEntityFeature,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL,
|
||||
ATTR_TEMPERATURE,
|
||||
PRECISION_HALVES,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_HALVES, UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import (
|
||||
ATTR_STATE_BATTERY_LOW,
|
||||
ATTR_STATE_HOLIDAY_MODE,
|
||||
ATTR_STATE_SUMMER_MODE,
|
||||
ATTR_STATE_WINDOW_OPEN,
|
||||
DOMAIN,
|
||||
LOGGER,
|
||||
)
|
||||
from .const import DOMAIN, LOGGER
|
||||
from .coordinator import FritzboxConfigEntry, FritzboxDataUpdateCoordinator
|
||||
from .entity import FritzBoxDeviceEntity
|
||||
from .model import ClimateExtraAttributes
|
||||
from .sensor import value_scheduled_preset
|
||||
|
||||
HVAC_MODES = [HVACMode.HEAT, HVACMode.OFF]
|
||||
@@ -202,26 +189,6 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
|
||||
self.check_active_or_lock_mode()
|
||||
await self.async_set_hkr_state(PRESET_API_HKR_STATE_MAPPING[preset_mode])
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> ClimateExtraAttributes:
|
||||
"""Return the device specific state attributes."""
|
||||
# deprecated with #143394, can be removed in 2025.11
|
||||
attrs: ClimateExtraAttributes = {
|
||||
ATTR_STATE_BATTERY_LOW: self.data.battery_low,
|
||||
}
|
||||
|
||||
# the following attributes are available since fritzos 7
|
||||
if self.data.battery_level is not None:
|
||||
attrs[ATTR_BATTERY_LEVEL] = self.data.battery_level
|
||||
if self.data.holiday_active is not None:
|
||||
attrs[ATTR_STATE_HOLIDAY_MODE] = self.data.holiday_active
|
||||
if self.data.summer_active is not None:
|
||||
attrs[ATTR_STATE_SUMMER_MODE] = self.data.summer_active
|
||||
if self.data.window_open is not None:
|
||||
attrs[ATTR_STATE_WINDOW_OPEN] = self.data.window_open
|
||||
|
||||
return attrs
|
||||
|
||||
def check_active_or_lock_mode(self) -> None:
|
||||
"""Check if in summer/vacation mode or lock enabled."""
|
||||
if self.data.holiday_active or self.data.summer_active:
|
||||
|
||||
@@ -49,11 +49,8 @@
|
||||
# name: test_setup[climate.fake_name-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'battery_level': 23,
|
||||
'battery_low': True,
|
||||
'current_temperature': 18.0,
|
||||
'friendly_name': 'fake_name',
|
||||
'holiday_mode': False,
|
||||
'hvac_modes': list([
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
<HVACMode.OFF: 'off'>,
|
||||
@@ -66,10 +63,8 @@
|
||||
'comfort',
|
||||
'boost',
|
||||
]),
|
||||
'summer_mode': False,
|
||||
'supported_features': <ClimateEntityFeature: 401>,
|
||||
'temperature': 19.5,
|
||||
'window_open': 'fake_window',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'climate.fake_name',
|
||||
|
||||
@@ -31,11 +31,7 @@ from homeassistant.components.fritzbox.climate import (
|
||||
PRESET_HOLIDAY,
|
||||
PRESET_SUMMER,
|
||||
)
|
||||
from homeassistant.components.fritzbox.const import (
|
||||
ATTR_STATE_HOLIDAY_MODE,
|
||||
ATTR_STATE_SUMMER_MODE,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE, CONF_DEVICES, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -588,8 +584,6 @@ async def test_holidy_summer_mode(
|
||||
# initial state
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state
|
||||
assert state.attributes[ATTR_STATE_HOLIDAY_MODE] is False
|
||||
assert state.attributes[ATTR_STATE_SUMMER_MODE] is False
|
||||
assert state.attributes[ATTR_HVAC_MODES] == [HVACMode.HEAT, HVACMode.OFF]
|
||||
assert state.attributes[ATTR_PRESET_MODE] is None
|
||||
assert state.attributes[ATTR_PRESET_MODES] == [
|
||||
@@ -607,8 +601,6 @@ async def test_holidy_summer_mode(
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state
|
||||
assert state.attributes[ATTR_STATE_HOLIDAY_MODE]
|
||||
assert state.attributes[ATTR_STATE_SUMMER_MODE] is False
|
||||
assert state.attributes[ATTR_HVAC_MODES] == [HVACMode.HEAT, HVACMode.OFF]
|
||||
assert state.attributes[ATTR_PRESET_MODE] == PRESET_HOLIDAY
|
||||
assert state.attributes[ATTR_PRESET_MODES] == [PRESET_HOLIDAY]
|
||||
@@ -643,8 +635,6 @@ async def test_holidy_summer_mode(
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state
|
||||
assert state.attributes[ATTR_STATE_HOLIDAY_MODE] is False
|
||||
assert state.attributes[ATTR_STATE_SUMMER_MODE]
|
||||
assert state.attributes[ATTR_HVAC_MODES] == [HVACMode.HEAT, HVACMode.OFF]
|
||||
assert state.attributes[ATTR_PRESET_MODE] == PRESET_SUMMER
|
||||
assert state.attributes[ATTR_PRESET_MODES] == [PRESET_SUMMER]
|
||||
@@ -679,8 +669,6 @@ async def test_holidy_summer_mode(
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state
|
||||
assert state.attributes[ATTR_STATE_HOLIDAY_MODE] is False
|
||||
assert state.attributes[ATTR_STATE_SUMMER_MODE] is False
|
||||
assert state.attributes[ATTR_HVAC_MODES] == [HVACMode.HEAT, HVACMode.OFF]
|
||||
assert state.attributes[ATTR_PRESET_MODE] is None
|
||||
assert state.attributes[ATTR_PRESET_MODES] == [
|
||||
|
||||
Reference in New Issue
Block a user