mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Deprecate aux_heat in econet (#125365)
* Deprecate aux_heat in econet * strings * Use generator
This commit is contained in:
parent
c2d5696b5b
commit
a7a219b99b
@ -31,6 +31,7 @@ PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
Platform.WATER_HEATER,
|
||||
]
|
||||
PUSH_UPDATE = "econet.push_update"
|
||||
|
@ -20,6 +20,7 @@ from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
|
||||
from . import EcoNetEntity
|
||||
from .const import DOMAIN, EQUIPMENT
|
||||
@ -203,10 +204,30 @@ class EcoNetThermostat(EcoNetEntity, ClimateEntity):
|
||||
|
||||
def turn_aux_heat_on(self) -> None:
|
||||
"""Turn auxiliary heater on."""
|
||||
async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
"migrate_aux_heat",
|
||||
breaks_in_ha_version="2025.4.0",
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
translation_key="migrate_aux_heat",
|
||||
severity=IssueSeverity.WARNING,
|
||||
)
|
||||
self._econet.set_mode(ThermostatOperationMode.EMERGENCY_HEAT)
|
||||
|
||||
def turn_aux_heat_off(self) -> None:
|
||||
"""Turn auxiliary heater off."""
|
||||
async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
"migrate_aux_heat",
|
||||
breaks_in_ha_version="2025.4.0",
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
translation_key="migrate_aux_heat",
|
||||
severity=IssueSeverity.WARNING,
|
||||
)
|
||||
self._econet.set_mode(ThermostatOperationMode.HEATING)
|
||||
|
||||
@property
|
||||
|
@ -18,5 +18,18 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"migrate_aux_heat": {
|
||||
"title": "Migration of EcoNet set_aux_heat action",
|
||||
"fix_flow": {
|
||||
"step": {
|
||||
"confirm": {
|
||||
"description": "The EcoNet `set_aux_heat` action has been migrated. A new `aux_heat_only` switch entity is available for each thermostat.\n\nUpdate any automations to use the new `aux_heat_only` switch entity. When this is done, Press submit to fix this issue.",
|
||||
"title": "[%key:component::econet::issues::migrate_aux_heat::title%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
homeassistant/components/econet/switch.py
Normal file
57
homeassistant/components/econet/switch.py
Normal file
@ -0,0 +1,57 @@
|
||||
"""Support for using switch with ecoNet thermostats."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pyeconet.equipment import EquipmentType
|
||||
from pyeconet.equipment.thermostat import ThermostatOperationMode
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import EcoNetEntity
|
||||
from .const import DOMAIN, EQUIPMENT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the ecobee thermostat switch entity."""
|
||||
equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
|
||||
async_add_entities(
|
||||
EcoNetSwitchAuxHeatOnly(thermostat)
|
||||
for thermostat in equipment[EquipmentType.THERMOSTAT]
|
||||
)
|
||||
|
||||
|
||||
class EcoNetSwitchAuxHeatOnly(EcoNetEntity, SwitchEntity):
|
||||
"""Representation of a aux_heat_only EcoNet switch."""
|
||||
|
||||
def __init__(self, thermostat) -> None:
|
||||
"""Initialize EcoNet ventilator platform."""
|
||||
super().__init__(thermostat)
|
||||
self._attr_name = f"{thermostat.device_name} emergency heat"
|
||||
self._attr_unique_id = (
|
||||
f"{thermostat.device_id}_{thermostat.device_name}_auxheat"
|
||||
)
|
||||
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Set the hvacMode to auxHeatOnly."""
|
||||
self._econet.set_mode(ThermostatOperationMode.EMERGENCY_HEAT)
|
||||
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Set the hvacMode back to the prior setting."""
|
||||
self._econet.set_mode(ThermostatOperationMode.HEATING)
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if auxHeatOnly mode is active."""
|
||||
return self._econet.mode == ThermostatOperationMode.EMERGENCY_HEAT
|
Loading…
x
Reference in New Issue
Block a user