1 """Support for Genius Hub climate devices."""
3 from __future__
import annotations
16 from .
import GeniusHubConfigEntry
17 from .entity
import GeniusHeatingZone
20 HA_HVAC_TO_GH = {HVACMode.OFF:
"off", HVACMode.HEAT:
"timer"}
21 GH_HVAC_TO_HA = {v: k
for k, v
in HA_HVAC_TO_GH.items()}
23 HA_PRESET_TO_GH = {PRESET_ACTIVITY:
"footprint", PRESET_BOOST:
"override"}
24 GH_PRESET_TO_HA = {v: k
for k, v
in HA_PRESET_TO_GH.items()}
26 GH_ZONES = [
"radiator",
"wet underfloor"]
31 entry: GeniusHubConfigEntry,
32 async_add_entities: AddEntitiesCallback,
34 """Set up the Genius Hub climate entities."""
36 broker = entry.runtime_data
40 for z
in broker.client.zone_objs
41 if z.data.get(
"type")
in GH_ZONES
46 """Representation of a Genius Hub climate device."""
48 _attr_supported_features = (
49 ClimateEntityFeature.TARGET_TEMPERATURE
50 | ClimateEntityFeature.PRESET_MODE
51 | ClimateEntityFeature.TURN_OFF
52 | ClimateEntityFeature.TURN_ON
54 _enable_turn_on_off_backwards_compatibility =
False
57 """Initialize the climate device."""
65 """Return the icon to use in the frontend UI."""
70 """Return hvac operation ie. heat, cool mode."""
71 return GH_HVAC_TO_HA.get(self.
_zone_zone.data[
"mode"], HVACMode.HEAT)
75 """Return the list of available hvac operation modes."""
76 return list(HA_HVAC_TO_GH)
80 """Return the current running hvac operation if supported."""
81 if "_state" in self.
_zone_zone.data:
82 if self.
_zone_zone.data[
"output"] == 1:
83 return HVACAction.HEATING
84 if not self.
_zone_zone.data[
"_state"].
get(
"bIsActive"):
86 return HVACAction.IDLE
91 """Return the current preset mode, e.g., home, away, temp."""
92 return GH_PRESET_TO_HA.get(self.
_zone_zone.data[
"mode"])
96 """Return a list of available preset modes."""
97 if "occupied" in self.
_zone_zone.data:
98 return [PRESET_ACTIVITY, PRESET_BOOST]
102 """Set a new hvac mode."""
103 await self.
_zone_zone.set_mode(HA_HVAC_TO_GH.get(hvac_mode))
106 """Set a new preset mode."""
107 await self.
_zone_zone.set_mode(HA_PRESET_TO_GH.get(preset_mode,
"timer"))
None async_set_hvac_mode(self, HVACMode hvac_mode)
None async_set_preset_mode(self, str preset_mode)
list[HVACMode] hvac_modes(self)
str|None preset_mode(self)
HVACAction|None hvac_action(self)
None __init__(self, broker, zone)
list[str]|None preset_modes(self)
web.Response get(self, web.Request request, str config_key)
None async_setup_entry(HomeAssistant hass, GeniusHubConfigEntry entry, AddEntitiesCallback async_add_entities)