1 """Support for XS1 climate devices."""
3 from __future__
import annotations
7 from xs1_api_client.api_constants
import ActuatorType
19 from .
import ACTUATORS, DOMAIN
as COMPONENT_DOMAIN, SENSORS
20 from .entity
import XS1DeviceEntity
29 add_entities: AddEntitiesCallback,
30 discovery_info: DiscoveryInfoType |
None =
None,
32 """Set up the XS1 thermostat platform."""
33 actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS]
34 sensors = hass.data[COMPONENT_DOMAIN][SENSORS]
36 thermostat_entities = []
37 for actuator
in actuators:
38 if actuator.type() == ActuatorType.TEMPERATURE:
40 actuator_name = actuator.name()
42 matching_sensor =
None
43 for sensor
in sensors:
44 if actuator_name
in sensor.name():
45 matching_sensor = sensor
54 """Representation of a XS1 thermostat."""
56 _attr_hvac_mode = HVACMode.HEAT
57 _attr_hvac_modes = [HVACMode.HEAT]
58 _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
59 _enable_turn_on_off_backwards_compatibility =
False
62 """Initialize the actuator."""
68 """Return the name of the device if any."""
73 """Return the current temperature."""
74 if self.
sensorsensor
is None:
77 return self.
sensorsensor.value()
81 """Return the unit of measurement used by the platform."""
82 return self.
devicedevice.unit()
86 """Return the current target temperature."""
87 return self.
devicedevice.new_value()
91 """Return the minimum temperature."""
96 """Return the maximum temperature."""
100 """Set new target temperature."""
101 temp = kwargs.get(ATTR_TEMPERATURE)
103 self.
devicedevice.set_value(temp)
105 if self.
sensorsensor
is not None:
109 """Set new target hvac mode."""
112 """Also update the sensor when available."""
114 if self.
sensorsensor
is not None:
115 await self.
hasshass.async_add_executor_job(self.
sensorsensor.update)
None set_temperature(self, **Any kwargs)
def current_temperature(self)
def target_temperature(self)
None set_hvac_mode(self, HVACMode hvac_mode)
str temperature_unit(self)
def __init__(self, device, sensor)
None schedule_update_ha_state(self, bool force_refresh=False)
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)