1 """Support for Bryant Evolution HVAC systems."""
3 from datetime
import timedelta
7 from evolutionhttp
import BryantEvolutionLocalClient
22 from .
import BryantEvolutionConfigEntry, names
23 from .const
import CONF_SYSTEM_ZONE, DOMAIN
25 _LOGGER = logging.getLogger(__name__)
33 config_entry: BryantEvolutionConfigEntry,
34 async_add_entities: AddEntitiesCallback,
36 """Set up a config entry."""
39 sam_uid = names.sam_device_uid(config_entry)
40 entities: list[Entity] = []
41 for sz
in config_entry.data[CONF_SYSTEM_ZONE]:
44 client = config_entry.runtime_data.get(
tuple(sz))
51 entities.append(climate)
56 """ClimateEntity for Bryant Evolution HVAC systems.
58 Design note: this class updates using polling. However, polling
59 is very slow (~1500 ms / parameter). To improve the user
60 experience on updates, we also locally update this instance and
61 call async_write_ha_state as well.
64 _attr_has_entity_name =
True
65 _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
66 _attr_supported_features = (
67 ClimateEntityFeature.TARGET_TEMPERATURE
68 | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
69 | ClimateEntityFeature.FAN_MODE
70 | ClimateEntityFeature.TURN_ON
71 | ClimateEntityFeature.TURN_OFF
79 _attr_fan_modes = [
"auto",
"low",
"med",
"high"]
80 _enable_turn_on_off_backwards_compatibility =
False
84 client: BryantEvolutionLocalClient,
89 """Initialize an entity from parts."""
92 self.
_attr_unique_id_attr_unique_id = names.zone_entity_uid(sam_uid, system_id, zone_id)
95 manufacturer=
"Bryant",
96 via_device=(DOMAIN, names.system_device_uid(sam_uid, system_id)),
97 name=f
"System {system_id} Zone {zone_id}",
101 """Update the entity state."""
103 if (fan_mode := await self.
_client_client.read_fan_mode())
is not None:
116 await self.
_client_client.read_heating_setpoint()
120 await self.
_client_client.read_cooling_setpoint()
122 case HVACMode.HEAT_COOL:
124 await self.
_client_client.read_cooling_setpoint()
127 await self.
_client_client.read_heating_setpoint()
132 _LOGGER.error(
"Unknown HVAC mode %s", self.
_attr_hvac_mode_attr_hvac_mode)
139 mode_and_active = await self.
_client_client.read_hvac_mode()
140 if not mode_and_active:
142 translation_domain=DOMAIN, translation_key=
"failed_to_read_hvac_mode"
144 mode = mode_and_active[0]
146 "HEAT": HVACMode.HEAT,
147 "COOL": HVACMode.COOL,
148 "AUTO": HVACMode.HEAT_COOL,
151 if mode_enum
is None:
153 translation_domain=DOMAIN,
154 translation_key=
"failed_to_parse_hvac_mode",
155 translation_placeholders={
"mode": mode},
160 """Return the current running hvac operation."""
161 mode_and_active = await self.
_client_client.read_hvac_mode()
162 if not mode_and_active:
164 translation_domain=DOMAIN, translation_key=
"failed_to_read_hvac_action"
166 mode, is_active = mode_and_active
168 return HVACAction.OFF
171 return HVACAction.HEATING
173 return HVACAction.COOLING
175 return HVACAction.OFF
187 return HVACAction.COOLING
188 return HVACAction.HEATING
190 translation_domain=DOMAIN,
191 translation_key=
"failed_to_parse_hvac_mode",
192 translation_placeholders={
193 "mode_and_active": mode_and_active,
200 """Set new target hvac mode."""
201 if hvac_mode == HVACMode.HEAT_COOL:
202 hvac_mode = HVACMode.AUTO
205 translation_domain=DOMAIN, translation_key=
"failed_to_set_hvac_mode"
211 """Set new target temperature."""
212 if kwargs.get(
"target_temp_high"):
213 temp =
int(kwargs[
"target_temp_high"])
214 if not await self.
_client_client.set_cooling_setpoint(temp):
216 translation_domain=DOMAIN, translation_key=
"failed_to_set_clsp"
220 if kwargs.get(
"target_temp_low"):
221 temp =
int(kwargs[
"target_temp_low"])
222 if not await self.
_client_client.set_heating_setpoint(temp):
224 translation_domain=DOMAIN, translation_key=
"failed_to_set_htsp"
228 if kwargs.get(
"temperature"):
229 temp =
int(kwargs[
"temperature"])
231 self.
_client_client.set_heating_setpoint
233 else self.
_client_client.set_cooling_setpoint
235 if not await fn(temp):
237 translation_domain=DOMAIN, translation_key=
"failed_to_set_temp"
246 """Set new target fan mode."""
249 translation_domain=DOMAIN, translation_key=
"failed_to_set_fan_mode"
_attr_current_temperature
None async_set_temperature(self, **Any kwargs)
HVACAction _read_hvac_action(self)
None __init__(self, BryantEvolutionLocalClient client, int system_id, int zone_id, str sam_uid)
None async_set_hvac_mode(self, HVACMode hvac_mode)
_attr_target_temperature_low
_attr_target_temperature_high
None async_set_fan_mode(self, str fan_mode)
HVACMode _read_hvac_mode(self)
None set_fan_mode(self, str fan_mode)
None set_hvac_mode(self, HVACMode hvac_mode)
float|None target_temperature_low(self)
HVACMode|None hvac_mode(self)
float|None current_temperature(self)
None _async_write_ha_state(self)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, BryantEvolutionConfigEntry config_entry, AddEntitiesCallback async_add_entities)
web.Response get(self, web.Request request, str config_key)