1 """Support for using humidifier with ecobee thermostats."""
3 from __future__
import annotations
5 from datetime
import timedelta
11 HumidifierDeviceClass,
13 HumidifierEntityFeature,
20 from .const
import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
24 MODE_MANUAL =
"manual"
30 config_entry: ConfigEntry,
31 async_add_entities: AddEntitiesCallback,
33 """Set up the ecobee thermostat humidifier entity."""
34 data = hass.data[DOMAIN]
36 for index
in range(len(data.ecobee.thermostats)):
37 thermostat = data.ecobee.get_thermostat(index)
38 if thermostat[
"settings"][
"hasHumidifier"]:
45 """A humidifier class for an ecobee thermostat with humidifier attached."""
47 _attr_supported_features = HumidifierEntityFeature.MODES
48 _attr_available_modes = [MODE_OFF, MODE_AUTO, MODE_MANUAL]
49 _attr_device_class = HumidifierDeviceClass.HUMIDIFIER
50 _attr_min_humidity = DEFAULT_MIN_HUMIDITY
51 _attr_max_humidity = DEFAULT_MAX_HUMIDITY
52 _attr_has_entity_name =
True
56 """Initialize ecobee humidifier platform."""
67 """Return device information for the ecobee humidifier."""
70 model = f
"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat"
76 identifiers={(DOMAIN, self.
thermostatthermostat[
"identifier"])},
77 manufacturer=MANUFACTURER,
84 """Return if device is available."""
85 return self.
thermostatthermostat[
"runtime"][
"connected"]
88 """Get the latest state from the thermostat."""
100 """Return True if the humidifier is on."""
101 return self.
modemodemode != MODE_OFF
105 """Return the current mode, e.g., off, auto, manual."""
106 return self.
thermostatthermostat[
"settings"][
"humidifierMode"]
110 """Return the desired humidity set point."""
111 return int(self.
thermostatthermostat[
"runtime"][
"desiredHumidity"])
115 """Return the current humidity."""
117 return int(self.
thermostatthermostat[
"runtime"][
"actualHumidity"])
122 """Set humidifier mode (auto, off, manual)."""
125 f
"Invalid mode value: {mode} Valid values are"
126 f
" {', '.join(self.available_modes)}."
133 """Set the humidity level."""
138 """Set humidifier to off mode."""
142 """Set humidifier to on mode."""
def turn_on(self, **kwargs)
None set_humidity(self, int humidity)
def __init__(self, data, thermostat_index)
def turn_off(self, **kwargs)
DeviceInfo device_info(self)
int target_humidity(self)
int|None current_humidity(self)
list[str]|None available_modes(self)
None set_mode(self, str mode)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
IssData update(pyiss.ISS iss)