1 """Support for the EPH Controls Ember themostats."""
3 from __future__
import annotations
5 from datetime
import timedelta
9 from pyephember.pyephember
import (
12 zone_current_temperature,
18 zone_target_temperature,
20 import voluptuous
as vol
23 PLATFORM_SCHEMA
as CLIMATE_PLATFORM_SCHEMA,
40 _LOGGER = logging.getLogger(__name__)
45 OPERATION_LIST = [HVACMode.HEAT_COOL, HVACMode.HEAT, HVACMode.OFF]
47 PLATFORM_SCHEMA = CLIMATE_PLATFORM_SCHEMA.extend(
48 {vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string}
52 "AUTO": HVACMode.HEAT_COOL,
57 HA_STATE_TO_EPH = {value: key
for key, value
in EPH_TO_HA_STATE.items()}
63 add_entities: AddEntitiesCallback,
64 discovery_info: DiscoveryInfoType |
None =
None,
66 """Set up the ephember thermostat."""
67 username = config.get(CONF_USERNAME)
68 password = config.get(CONF_PASSWORD)
71 ember = EphEmber(username, password)
72 zones = ember.get_zones()
76 _LOGGER.error(
"Cannot connect to EphEmber")
83 """Representation of a EphEmber thermostat."""
85 _attr_hvac_modes = OPERATION_LIST
86 _attr_temperature_unit = UnitOfTemperature.CELSIUS
87 _enable_turn_on_off_backwards_compatibility =
False
90 """Initialize the thermostat."""
99 ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.AUX_HEAT
106 ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
111 """Return the current temperature."""
112 return zone_current_temperature(self.
_zone_zone)
116 """Return the temperature we try to reach."""
117 return zone_target_temperature(self.
_zone_zone)
121 """Return current HVAC action."""
122 if zone_is_active(self.
_zone_zone):
123 return HVACAction.HEATING
125 return HVACAction.IDLE
129 """Return current operation ie. heat, cool, idle."""
130 mode = zone_mode(self.
_zone_zone)
134 """Set the operation mode."""
139 _LOGGER.error(
"Invalid operation mode provided %s", hvac_mode)
143 """Return true if aux heater."""
145 return zone_is_boost_active(self.
_zone_zone)
148 """Turn auxiliary heater on."""
149 self.
_ember_ember.activate_boost_by_name(
154 """Turn auxiliary heater off."""
158 """Set new target temperature."""
159 if (temperature := kwargs.get(ATTR_TEMPERATURE))
is None:
171 self.
_ember_ember.set_target_temperture_by_name(self.
_zone_name_zone_name, temperature)
175 """Return the minimum temperature."""
178 return zone_target_temperature(self.
_zone_zone)
184 """Return the maximum temperature."""
186 return zone_target_temperature(self.
_zone_zone)
191 """Get the latest data."""
196 """Map from Home Assistant mode to eph mode."""
197 return getattr(ZoneMode, HA_STATE_TO_EPH.get(operation_mode),
None)
201 """Map from eph mode to Home Assistant mode."""
202 return EPH_TO_HA_STATE.get(operation_mode.name, HVACMode.HEAT_COOL)
float|None target_temperature(self)
def target_temperature(self)
_attr_target_temperature_step
None turn_aux_heat_on(self)
None set_hvac_mode(self, HVACMode hvac_mode)
None set_temperature(self, **Any kwargs)
def __init__(self, ember, zone)
def map_mode_eph_hass(operation_mode)
def current_temperature(self)
None turn_aux_heat_off(self)
def map_mode_hass_eph(operation_mode)
HVACAction hvac_action(self)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)