1 """Support for Rheem EcoNet thermostats."""
5 from pyeconet.equipment
import EquipmentType
6 from pyeconet.equipment.thermostat
import ThermostatFanMode, ThermostatOperationMode
25 from .const
import DOMAIN, EQUIPMENT
26 from .entity
import EcoNetEntity
28 ECONET_STATE_TO_HA = {
29 ThermostatOperationMode.HEATING: HVACMode.HEAT,
30 ThermostatOperationMode.COOLING: HVACMode.COOL,
31 ThermostatOperationMode.OFF: HVACMode.OFF,
32 ThermostatOperationMode.AUTO: HVACMode.HEAT_COOL,
33 ThermostatOperationMode.FAN_ONLY: HVACMode.FAN_ONLY,
35 HA_STATE_TO_ECONET = {value: key
for key, value
in ECONET_STATE_TO_HA.items()}
37 ECONET_FAN_STATE_TO_HA = {
38 ThermostatFanMode.AUTO: FAN_AUTO,
39 ThermostatFanMode.LOW: FAN_LOW,
40 ThermostatFanMode.MEDIUM: FAN_MEDIUM,
41 ThermostatFanMode.HIGH: FAN_HIGH,
43 HA_FAN_STATE_TO_ECONET = {value: key
for key, value
in ECONET_FAN_STATE_TO_HA.items()}
45 SUPPORT_FLAGS_THERMOSTAT = (
46 ClimateEntityFeature.TARGET_TEMPERATURE
47 | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
48 | ClimateEntityFeature.FAN_MODE
49 | ClimateEntityFeature.AUX_HEAT
54 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
56 """Set up EcoNet thermostat based on a config entry."""
57 equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
61 for thermostat
in equipment[EquipmentType.THERMOSTAT]
67 """Define an Econet thermostat."""
69 _attr_should_poll =
True
70 _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
71 _enable_turn_on_off_backwards_compatibility =
False
77 for mode
in self.
_econet_econet.modes:
79 ThermostatOperationMode.UNKNOWN,
80 ThermostatOperationMode.EMERGENCY_HEAT,
82 ha_mode = ECONET_STATE_TO_HA[mode]
85 self._attr_supported_features |= SUPPORT_FLAGS_THERMOSTAT
86 if thermostat.supports_humidifier:
87 self._attr_supported_features |= ClimateEntityFeature.TARGET_HUMIDITY
89 self._attr_supported_features |= (
90 ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
95 """Return the current temperature."""
96 return self.
_econet_econet.set_point
100 """Return the current humidity."""
101 return self.
_econet_econet.humidity
105 """Return the humidity we try to reach."""
106 if self.
_econet_econet.supports_humidifier:
107 return self.
_econet_econet.dehumidifier_set_point
112 """Return the temperature we try to reach."""
114 return self.
_econet_econet.cool_set_point
116 return self.
_econet_econet.heat_set_point
121 """Return the lower bound temperature we try to reach."""
123 return self.
_econet_econet.heat_set_point
128 """Return the higher bound temperature we try to reach."""
130 return self.
_econet_econet.cool_set_point
134 """Set new target temperature."""
135 target_temp = kwargs.get(ATTR_TEMPERATURE)
136 target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
137 target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
139 self.
_econet_econet.set_set_point(target_temp,
None,
None)
140 if target_temp_low
or target_temp_high:
141 self.
_econet_econet.set_set_point(
None, target_temp_high, target_temp_low)
145 """Return true if aux heater."""
146 return self.
_econet_econet.mode == ThermostatOperationMode.EMERGENCY_HEAT
150 """Return hvac operation ie. heat, cool, mode.
152 Needs to be one of HVAC_MODE_*.
154 econet_mode = self.
_econet_econet.mode
155 _current_op = HVACMode.OFF
156 if econet_mode
is not None:
157 _current_op = ECONET_STATE_TO_HA[econet_mode]
162 """Set new target hvac mode."""
163 hvac_mode_to_set = HA_STATE_TO_ECONET.get(hvac_mode)
164 if hvac_mode_to_set
is None:
165 raise ValueError(f
"{hvac_mode} is not a valid mode.")
166 self.
_econet_econet.set_mode(hvac_mode_to_set)
169 """Set new target humidity."""
170 self.
_econet_econet.set_dehumidifier_set_point(humidity)
174 """Return the current fan mode."""
175 econet_fan_mode = self.
_econet_econet.fan_mode
178 if econet_fan_mode
in [ThermostatFanMode.MEDHI, ThermostatFanMode.MEDLO]:
179 econet_fan_mode = ThermostatFanMode.MEDIUM
181 _current_fan_mode = FAN_AUTO
182 if econet_fan_mode
is not None:
183 _current_fan_mode = ECONET_FAN_STATE_TO_HA[econet_fan_mode]
184 return _current_fan_mode
188 """Return the fan modes."""
190 ECONET_FAN_STATE_TO_HA[mode]
191 for mode
in self.
_econet_econet.fan_modes
195 ThermostatFanMode.UNKNOWN,
196 ThermostatFanMode.MEDLO,
197 ThermostatFanMode.MEDHI,
202 """Set the fan mode."""
206 """Turn auxiliary heater on."""
211 breaks_in_ha_version=
"2025.4.0",
214 translation_key=
"migrate_aux_heat",
215 severity=IssueSeverity.WARNING,
217 self.
_econet_econet.set_mode(ThermostatOperationMode.EMERGENCY_HEAT)
220 """Turn auxiliary heater off."""
225 breaks_in_ha_version=
"2025.4.0",
228 translation_key=
"migrate_aux_heat",
229 severity=IssueSeverity.WARNING,
231 self.
_econet_econet.set_mode(ThermostatOperationMode.HEATING)
235 """Return the minimum temperature."""
236 return self.
_econet_econet.set_point_limits[0]
240 """Return the maximum temperature."""
241 return self.
_econet_econet.set_point_limits[1]
245 """Return the minimum humidity."""
246 return self.
_econet_econet.dehumidifier_set_point_limits[0]
250 """Return the maximum humidity."""
251 return self.
_econet_econet.dehumidifier_set_point_limits[1]
HVACMode|None hvac_mode(self)
list[HVACMode] hvac_modes(self)
None set_humidity(self, int humidity)
def current_humidity(self)
None set_temperature(self, **Any kwargs)
None turn_aux_heat_on(self)
None turn_aux_heat_off(self)
def target_humidity(self)
def current_temperature(self)
def target_temperature_high(self)
def target_temperature(self)
def __init__(self, thermostat)
None set_fan_mode(self, str fan_mode)
None set_hvac_mode(self, HVACMode hvac_mode)
def target_temperature_low(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)
None async_create_issue(HomeAssistant hass, str entry_id)