mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Deprecate aux_heat from Nexia climate entity, implement switch (#125250)
* Remove deprecated aux_heat from nexia * Add back aux_heat * Raise issue
This commit is contained in:
parent
84def0c041
commit
2ef37f01b1
@ -35,6 +35,7 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||||
from homeassistant.helpers.typing import VolDictType
|
from homeassistant.helpers.typing import VolDictType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -42,6 +43,7 @@ from .const import (
|
|||||||
ATTR_DEHUMIDIFY_SETPOINT,
|
ATTR_DEHUMIDIFY_SETPOINT,
|
||||||
ATTR_HUMIDIFY_SETPOINT,
|
ATTR_HUMIDIFY_SETPOINT,
|
||||||
ATTR_RUN_MODE,
|
ATTR_RUN_MODE,
|
||||||
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from .coordinator import NexiaDataUpdateCoordinator
|
from .coordinator import NexiaDataUpdateCoordinator
|
||||||
from .entity import NexiaThermostatZoneEntity
|
from .entity import NexiaThermostatZoneEntity
|
||||||
@ -378,11 +380,31 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
|
|||||||
|
|
||||||
async def async_turn_aux_heat_off(self) -> None:
|
async def async_turn_aux_heat_off(self) -> None:
|
||||||
"""Turn Aux Heat off."""
|
"""Turn Aux Heat 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,
|
||||||
|
)
|
||||||
await self._thermostat.set_emergency_heat(False)
|
await self._thermostat.set_emergency_heat(False)
|
||||||
self._signal_thermostat_update()
|
self._signal_thermostat_update()
|
||||||
|
|
||||||
async def async_turn_aux_heat_on(self) -> None:
|
async def async_turn_aux_heat_on(self) -> None:
|
||||||
"""Turn Aux Heat on."""
|
"""Turn Aux Heat 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,
|
||||||
|
)
|
||||||
await self._thermostat.set_emergency_heat(True)
|
await self._thermostat.set_emergency_heat(True)
|
||||||
self._signal_thermostat_update()
|
self._signal_thermostat_update()
|
||||||
|
|
||||||
|
@ -96,5 +96,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"issues": {
|
||||||
|
"migrate_aux_heat": {
|
||||||
|
"title": "Migration of Nexia set_aux_heat action",
|
||||||
|
"fix_flow": {
|
||||||
|
"step": {
|
||||||
|
"confirm": {
|
||||||
|
"description": "The Nexia `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 Emergency heat switch entity. When this is done, press submit to fix this issue.",
|
||||||
|
"title": "[%key:component::nexia::issues::migrate_aux_heat::title%]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,14 @@ async def async_setup_entry(
|
|||||||
"""Set up switches for a Nexia device."""
|
"""Set up switches for a Nexia device."""
|
||||||
coordinator = config_entry.runtime_data
|
coordinator = config_entry.runtime_data
|
||||||
nexia_home = coordinator.nexia_home
|
nexia_home = coordinator.nexia_home
|
||||||
entities: list[NexiaHoldSwitch] = []
|
entities: list[NexiaHoldSwitch | NexiaEmergencyHeatSwitch] = []
|
||||||
for thermostat_id in nexia_home.get_thermostat_ids():
|
for thermostat_id in nexia_home.get_thermostat_ids():
|
||||||
thermostat: NexiaThermostat = nexia_home.get_thermostat_by_id(thermostat_id)
|
thermostat: NexiaThermostat = nexia_home.get_thermostat_by_id(thermostat_id)
|
||||||
for zone_id in thermostat.get_zone_ids():
|
for zone_id in thermostat.get_zone_ids():
|
||||||
zone: NexiaThermostatZone = thermostat.get_zone_by_id(zone_id)
|
zone: NexiaThermostatZone = thermostat.get_zone_by_id(zone_id)
|
||||||
entities.append(NexiaHoldSwitch(coordinator, zone))
|
entities.append(NexiaHoldSwitch(coordinator, zone))
|
||||||
|
if thermostat.has_emergency_heat():
|
||||||
|
entities.append(NexiaEmergencyHeatSwitch(coordinator, zone))
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
@ -64,3 +66,31 @@ class NexiaHoldSwitch(NexiaThermostatZoneEntity, SwitchEntity):
|
|||||||
"""Disable permanent hold."""
|
"""Disable permanent hold."""
|
||||||
await self._zone.call_return_to_schedule()
|
await self._zone.call_return_to_schedule()
|
||||||
self._signal_zone_update()
|
self._signal_zone_update()
|
||||||
|
|
||||||
|
|
||||||
|
class NexiaEmergencyHeatSwitch(NexiaThermostatZoneEntity, SwitchEntity):
|
||||||
|
"""Provides Nexia emergency heat switch support."""
|
||||||
|
|
||||||
|
_attr_translation_key = "emergency_heat"
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self, coordinator: NexiaDataUpdateCoordinator, zone: NexiaThermostatZone
|
||||||
|
) -> None:
|
||||||
|
"""Initialize the emergency heat mode switch."""
|
||||||
|
zone_id = zone.zone_id
|
||||||
|
super().__init__(coordinator, zone, zone_id)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self) -> bool:
|
||||||
|
"""Return if the zone is in hold mode."""
|
||||||
|
return self._thermostat.is_emergency_heat_active()
|
||||||
|
|
||||||
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
|
"""Enable permanent hold."""
|
||||||
|
await self._thermostat.set_emergency_heat(True)
|
||||||
|
self._signal_thermostat_update()
|
||||||
|
|
||||||
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
|
"""Disable permanent hold."""
|
||||||
|
await self._thermostat.set_emergency_heat(False)
|
||||||
|
self._signal_thermostat_update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user