1 """Support for XS1 sensors."""
3 from __future__
import annotations
5 from xs1_api_client.api_constants
import ActuatorType
12 from .
import ACTUATORS, DOMAIN
as COMPONENT_DOMAIN, SENSORS
13 from .entity
import XS1DeviceEntity
19 add_entities: AddEntitiesCallback,
20 discovery_info: DiscoveryInfoType |
None =
None,
22 """Set up the XS1 sensor platform."""
23 sensors = hass.data[COMPONENT_DOMAIN][SENSORS]
24 actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS]
27 for sensor
in sensors:
28 belongs_to_climate_actuator =
False
29 for actuator
in actuators:
31 actuator.type() == ActuatorType.TEMPERATURE
32 and actuator.name()
in sensor.name()
34 belongs_to_climate_actuator =
True
37 if not belongs_to_climate_actuator:
44 """Representation of a Sensor."""
48 """Return the name of the sensor."""
53 """Return the state of the sensor."""
54 return self.
devicedevice.value()
58 """Return the unit of measurement."""
59 return self.
devicedevice.unit()
def native_unit_of_measurement(self)
def add_entities(account, async_add_entities, tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)