1 """Sensor platform for the PoolSense sensor."""
3 from __future__
import annotations
8 SensorEntityDescription,
15 from .
import PoolSenseConfigEntry
16 from .entity
import PoolSenseEntity
18 SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
21 translation_key=
"chlorine",
22 native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
26 device_class=SensorDeviceClass.PH,
30 native_unit_of_measurement=PERCENTAGE,
31 device_class=SensorDeviceClass.BATTERY,
35 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
36 translation_key=
"water_temp",
37 device_class=SensorDeviceClass.TEMPERATURE,
41 translation_key=
"last_seen",
42 device_class=SensorDeviceClass.TIMESTAMP,
46 translation_key=
"chlorine_high",
47 native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
51 translation_key=
"chlorine_low",
52 native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
56 translation_key=
"ph_high",
60 translation_key=
"ph_low",
67 config_entry: PoolSenseConfigEntry,
68 async_add_entities: AddEntitiesCallback,
70 """Defer sensor setup to the shared sensor module."""
71 coordinator = config_entry.runtime_data
74 PoolSenseSensor(coordinator, description)
for description
in SENSOR_TYPES
79 """Sensor representing poolsense data."""
83 """State of the sensor."""
StateType native_value(self)
None async_setup_entry(HomeAssistant hass, PoolSenseConfigEntry config_entry, AddEntitiesCallback async_add_entities)