-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate aux_heat in econet (#125365)
* Deprecate aux_heat in econet * strings * Use generator
- Loading branch information
1 parent
c2d5696
commit a7a219b
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |