mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Add ecobee humidity attributes (#44366)
* Update humidity attributes. * Update climate.py * Raise ValueError * Update conditions for humidity controls to show Humidity controls only show when the humidifier mode is in "manual" mode.
This commit is contained in:
parent
f89c682ea6
commit
1ca99c4fa4
@ -65,6 +65,11 @@ AWAY_MODE = "awayMode"
|
|||||||
PRESET_HOME = "home"
|
PRESET_HOME = "home"
|
||||||
PRESET_SLEEP = "sleep"
|
PRESET_SLEEP = "sleep"
|
||||||
|
|
||||||
|
DEFAULT_MIN_HUMIDITY = 15
|
||||||
|
DEFAULT_MAX_HUMIDITY = 50
|
||||||
|
HUMIDIFIER_MANUAL_MODE = "manual"
|
||||||
|
|
||||||
|
|
||||||
# Order matters, because for reverse mapping we don't want to map HEAT to AUX
|
# Order matters, because for reverse mapping we don't want to map HEAT to AUX
|
||||||
ECOBEE_HVAC_TO_HASS = collections.OrderedDict(
|
ECOBEE_HVAC_TO_HASS = collections.OrderedDict(
|
||||||
[
|
[
|
||||||
@ -162,7 +167,6 @@ SUPPORT_FLAGS = (
|
|||||||
| SUPPORT_AUX_HEAT
|
| SUPPORT_AUX_HEAT
|
||||||
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
||||||
| SUPPORT_FAN_MODE
|
| SUPPORT_FAN_MODE
|
||||||
| SUPPORT_TARGET_HUMIDITY
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -332,6 +336,8 @@ class Thermostat(ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
|
if self.has_humidifier_control:
|
||||||
|
return SUPPORT_FLAGS | SUPPORT_TARGET_HUMIDITY
|
||||||
return SUPPORT_FLAGS
|
return SUPPORT_FLAGS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -391,6 +397,31 @@ class Thermostat(ClimateEntity):
|
|||||||
return self.thermostat["runtime"]["desiredCool"] / 10.0
|
return self.thermostat["runtime"]["desiredCool"] / 10.0
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_humidifier_control(self):
|
||||||
|
"""Return true if humidifier connected to thermostat and set to manual/on mode."""
|
||||||
|
return (
|
||||||
|
self.thermostat["settings"]["hasHumidifier"]
|
||||||
|
and self.thermostat["settings"]["humidifierMode"] == HUMIDIFIER_MANUAL_MODE
|
||||||
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_humidity(self) -> Optional[int]:
|
||||||
|
"""Return the desired humidity set point."""
|
||||||
|
if self.has_humidifier_control:
|
||||||
|
return self.thermostat["runtime"]["desiredHumidity"]
|
||||||
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def min_humidity(self) -> int:
|
||||||
|
"""Return the minimum humidity."""
|
||||||
|
return DEFAULT_MIN_HUMIDITY
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_humidity(self) -> int:
|
||||||
|
"""Return the maximum humidity."""
|
||||||
|
return DEFAULT_MAX_HUMIDITY
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
@ -653,7 +684,13 @@ class Thermostat(ClimateEntity):
|
|||||||
|
|
||||||
def set_humidity(self, humidity):
|
def set_humidity(self, humidity):
|
||||||
"""Set the humidity level."""
|
"""Set the humidity level."""
|
||||||
|
if humidity not in range(0, 101):
|
||||||
|
raise ValueError(
|
||||||
|
f"Invalid set_humidity value (must be in range 0-100): {humidity}"
|
||||||
|
)
|
||||||
|
|
||||||
self.data.ecobee.set_humidity(self.thermostat_index, int(humidity))
|
self.data.ecobee.set_humidity(self.thermostat_index, int(humidity))
|
||||||
|
self.update_without_throttle = True
|
||||||
|
|
||||||
def set_hvac_mode(self, hvac_mode):
|
def set_hvac_mode(self, hvac_mode):
|
||||||
"""Set HVAC mode (auto, auxHeatOnly, cool, heat, off)."""
|
"""Set HVAC mode (auto, auxHeatOnly, cool, heat, off)."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user