1 """Roth Touchline SL climate integration implementation for Home Assistant."""
15 from .
import TouchlineSLConfigEntry
16 from .coordinator
import TouchlineSLModuleCoordinator
17 from .entity
import TouchlineSLZoneEntity
22 entry: TouchlineSLConfigEntry,
23 async_add_entities: AddEntitiesCallback,
25 """Set up the Touchline devices."""
26 coordinators = entry.runtime_data
29 for coordinator
in coordinators
30 for zone_id
in coordinator.data.zones
34 CONSTANT_TEMPERATURE =
"constant_temperature"
38 """Roth Touchline SL Zone."""
40 _attr_hvac_action = HVACAction.IDLE
41 _attr_hvac_mode = HVACMode.HEAT
42 _attr_hvac_modes = [HVACMode.HEAT]
44 _attr_supported_features = (
45 ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
47 _attr_temperature_unit = UnitOfTemperature.CELSIUS
48 _attr_translation_key =
"zone"
50 def __init__(self, coordinator: TouchlineSLModuleCoordinator, zone_id: int) ->
None:
51 """Construct a Touchline SL climate zone."""
52 super().
__init__(coordinator, zone_id)
55 f
"module-{self.coordinator.data.module.id}-zone-{self.zone_id}"
64 """Handle updated data from the coordinator."""
69 """Set new target temperature."""
70 if (temperature := kwargs.get(ATTR_TEMPERATURE))
is None:
77 """Assign the zone to a particular global schedule."""
86 if schedule := self.coordinator.data.schedules[preset_mode]:
87 await self.
zonezone.set_schedule(schedule_id=schedule.id)
91 """Populate attributes with data from the coordinator."""
92 schedule_names = self.coordinator.data.schedules.keys()
99 if self.
zonezone.mode ==
"constantTemp":
101 elif self.
zonezone.mode ==
"globalSchedule":
102 schedule = self.
zonezone.schedule
105 if self.
zonezone.algorithm ==
"heating":
107 HVACAction.HEATING
if self.
zonezone.relay_on
else HVACAction.IDLE
111 elif self.
zonezone.algorithm ==
"cooling":
113 HVACAction.COOLING
if self.
zonezone.relay_on
else HVACAction.IDLE
None set_temperature(self, **Any kwargs)
None _handle_coordinator_update(self)
_attr_current_temperature
None async_set_preset_mode(self, str preset_mode)
None async_set_temperature(self, **Any kwargs)
None __init__(self, TouchlineSLModuleCoordinator coordinator, int zone_id)
None async_request_refresh(self)
None async_setup_entry(HomeAssistant hass, TouchlineSLConfigEntry entry, AddEntitiesCallback async_add_entities)