1 """Support for using number with ecobee thermostats."""
3 from __future__
import annotations
5 from collections.abc
import Awaitable, Callable
6 from dataclasses
import dataclass
12 NumberEntityDescription,
20 from .
import EcobeeData
21 from .const
import DOMAIN
22 from .entity
import EcobeeBaseEntity
24 _LOGGER = logging.getLogger(__name__)
27 @dataclass(frozen=True, kw_only=True)
29 """Class describing Ecobee number entities."""
31 ecobee_setting_key: str
32 set_fn: Callable[[EcobeeData, int, int], Awaitable]
35 VENTILATOR_NUMBERS = (
38 translation_key=
"ventilator_min_type_home",
39 ecobee_setting_key=
"ventilatorMinOnTimeHome",
40 set_fn=
lambda data, id, min_time: data.ecobee.set_ventilator_min_on_time_home(
46 translation_key=
"ventilator_min_type_away",
47 ecobee_setting_key=
"ventilatorMinOnTimeAway",
48 set_fn=
lambda data, id, min_time: data.ecobee.set_ventilator_min_on_time_away(
57 config_entry: ConfigEntry,
58 async_add_entities: AddEntitiesCallback,
60 """Set up the ecobee thermostat number entity."""
61 data: EcobeeData = hass.data[DOMAIN]
63 assert data
is not None
65 entities: list[NumberEntity] = [
67 for index, thermostat
in enumerate(data.ecobee.thermostats)
68 if thermostat[
"settings"][
"ventilatorType"] !=
"none"
69 for numbers
in VENTILATOR_NUMBERS
72 _LOGGER.debug(
"Adding compressor min temp number (if present)")
76 for index, thermostat
in enumerate(data.ecobee.thermostats)
77 if thermostat[
"settings"][
"hasHeatPump"]
85 """A number class, representing min time for an ecobee thermostat with ventilator attached."""
87 entity_description: EcobeeNumberEntityDescription
89 _attr_native_min_value = 0
90 _attr_native_max_value = 60
92 _attr_native_unit_of_measurement = UnitOfTime.MINUTES
93 _attr_has_entity_name =
True
98 thermostat_index: int,
99 description: EcobeeNumberEntityDescription,
101 """Initialize ecobee ventilator platform."""
102 super().
__init__(data, thermostat_index)
104 self.
_attr_unique_id_attr_unique_id = f
"{self.base_unique_id}_ventilator_{description.key}"
108 """Get the latest state from the thermostat."""
119 """Set new ventilator Min On Time value."""
125 """Minimum outdoor temperature at which the compressor will operate.
127 This applies more to air source heat pumps than geothermal. This serves as a safety
128 feature (compressors have a minimum operating temperature) as well as
129 providing the ability to choose fuel in a dual-fuel system (i.e. choose between
130 electrical heat pump and fossil auxiliary heat depending on Time of Use, Solar,
132 Note that python-ecobee-api refers to this as Aux Cutover Threshold, but Ecobee
133 uses Compressor Protection Min Temp.
136 _attr_device_class = NumberDeviceClass.TEMPERATURE
137 _attr_has_entity_name =
True
138 _attr_icon =
"mdi:thermometer-off"
139 _attr_mode = NumberMode.BOX
140 _attr_native_min_value = -25
141 _attr_native_max_value = 66
142 _attr_native_step = 5
143 _attr_native_unit_of_measurement = UnitOfTemperature.FAHRENHEIT
144 _attr_translation_key =
"compressor_protection_min_temp"
149 thermostat_index: int,
151 """Initialize ecobee compressor min temperature."""
152 super().
__init__(data, thermostat_index)
153 self.
_attr_unique_id_attr_unique_id = f
"{self.base_unique_id}_compressor_protection_min_temp"
157 """Get the latest state from the thermostat."""
165 (self.
thermostatthermostat[
"settings"][
"compressorProtectionMinTemp"]) / 10
169 """Set new compressor minimum temperature."""
dict[str, Any] thermostat(self)
None set_native_value(self, float value)
None __init__(self, EcobeeData data, int thermostat_index)
None set_native_value(self, float value)
None __init__(self, EcobeeData data, int thermostat_index, EcobeeNumberEntityDescription description)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
IssData update(pyiss.ISS iss)