1 """Platform for Roth Touchline floor heating controller."""
3 from __future__
import annotations
5 from typing
import Any, NamedTuple
7 from pytouchline
import PyTouchline
8 import voluptuous
as vol
11 PLATFORM_SCHEMA
as CLIMATE_PLATFORM_SCHEMA,
24 """Settings for preset mode."""
39 TOUCHLINE_HA_PRESETS = {
40 (settings.mode, settings.program): preset
41 for preset, settings
in PRESET_MODES.items()
44 PLATFORM_SCHEMA = CLIMATE_PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string})
50 add_entities: AddEntitiesCallback,
51 discovery_info: DiscoveryInfoType |
None =
None,
53 """Set up the Touchline devices."""
55 host = config[CONF_HOST]
56 py_touchline = PyTouchline()
57 number_of_devices =
int(py_touchline.get_number_of_devices(host))
59 (
Touchline(PyTouchline(device_id))
for device_id
in range(number_of_devices)),
65 """Representation of a Touchline device."""
67 _attr_hvac_mode = HVACMode.HEAT
68 _attr_hvac_modes = [HVACMode.HEAT]
69 _attr_supported_features = (
70 ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
72 _attr_temperature_unit = UnitOfTemperature.CELSIUS
73 _enable_turn_on_off_backwards_compatibility =
False
76 """Initialize the Touchline device."""
77 self.
unitunit = touchline_thermostat
85 """Update thermostat attributes."""
90 self.
_preset_mode_preset_mode = TOUCHLINE_HA_PRESETS.get(
91 (self.
unitunit.get_operation_mode(), self.
unitunit.get_week_program())
96 """Return the name of the climate device."""
97 return self.
_name_name
101 """Return the current temperature."""
106 """Return the temperature we try to reach."""
111 """Return the current preset mode."""
116 """Return available preset modes."""
117 return list(PRESET_MODES)
120 """Set new target preset mode."""
121 preset_mode = PRESET_MODES[preset_mode]
122 self.
unitunit.set_operation_mode(preset_mode.mode)
123 self.
unitunit.set_week_program(preset_mode.program)
126 """Set new target hvac mode."""
130 """Set new target temperature."""
131 if kwargs.get(ATTR_TEMPERATURE)
is not None:
def target_temperature(self)
None set_temperature(self, **Any kwargs)
None set_hvac_mode(self, HVACMode hvac_mode)
def current_temperature(self)
def __init__(self, touchline_thermostat)
def set_preset_mode(self, preset_mode)
str get_name(AirthingsDevice device)
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)