1 """Support for control of ElkM1 outputs (relays)."""
3 from __future__
import annotations
7 from elkm1_lib.const
import ThermostatMode, ThermostatSetting
8 from elkm1_lib.elements
import Element
9 from elkm1_lib.elk
import Elk
10 from elkm1_lib.outputs
import Output
11 from elkm1_lib.thermostats
import Thermostat
17 from .
import ElkM1ConfigEntry
18 from .entity
import ElkAttachedEntity, ElkEntity, create_elk_entities
19 from .models
import ELKM1Data
24 config_entry: ElkM1ConfigEntry,
25 async_add_entities: AddEntitiesCallback,
27 """Create the Elk-M1 switch platform."""
28 elk_data = config_entry.runtime_data
30 entities: list[ElkEntity] = []
33 elk_data, elk.thermostats,
"thermostat", ElkThermostatEMHeat, entities
39 """Elk output as switch."""
45 """Get the current output status."""
46 return self.
_element_element.output_on
49 """Turn on the output."""
53 """Turn off the output."""
58 """Elk Thermostat emergency heat as switch."""
62 def __init__(self, element: Element, elk: Elk, elk_data: ELKM1Data) ->
None:
63 """Initialize the emergency heat switch."""
64 super().
__init__(element, elk, elk_data)
70 """Get the current emergency heat status."""
71 return self.
_element_element.mode == ThermostatMode.EMERGENCY_HEAT
73 def _elk_set(self, mode: ThermostatMode) ->
None:
74 """Set the thermostat mode."""
75 self.
_element_element.set(ThermostatSetting.MODE, mode)
78 """Turn on the output."""
79 self.
_elk_set_elk_set(ThermostatMode.EMERGENCY_HEAT)
82 """Turn off the output."""
83 self.
_elk_set_elk_set(ThermostatMode.EMERGENCY_HEAT)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
None _elk_set(self, ThermostatMode mode)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
None __init__(self, Element element, Elk elk, ELKM1Data elk_data)
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
list[ElkEntity]|None create_elk_entities(ELKM1Data elk_data, Iterable[Element] elk_elements, str element_type, Any class_, list[ElkEntity] entities)
None async_setup_entry(HomeAssistant hass, ElkM1ConfigEntry config_entry, AddEntitiesCallback async_add_entities)