1 """The lookin integration sensor platform."""
3 from __future__
import annotations
10 SensorEntityDescription,
18 from .const
import DOMAIN
19 from .entity
import LookinDeviceCoordinatorEntity
20 from .models
import LookinData
22 LOGGER = logging.getLogger(__name__)
25 SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
29 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
30 device_class=SensorDeviceClass.TEMPERATURE,
31 state_class=SensorStateClass.MEASUREMENT,
36 native_unit_of_measurement=PERCENTAGE,
37 device_class=SensorDeviceClass.HUMIDITY,
38 state_class=SensorStateClass.MEASUREMENT,
45 config_entry: ConfigEntry,
46 async_add_entities: AddEntitiesCallback,
48 """Set up lookin sensors from the config entry."""
49 lookin_data: LookinData = hass.data[DOMAIN][config_entry.entry_id]
51 if lookin_data.lookin_device.model >= 2:
55 for description
in SENSOR_TYPES
61 """A lookin device sensor entity."""
64 self, description: SensorEntityDescription, lookin_data: LookinData
66 """Init the lookin sensor entity."""
69 self.
_attr_name_attr_name = f
"{self._lookin_device.name} {description.name}"
71 self.
_attr_unique_id_attr_unique_id = f
"{self._lookin_device.id}-{description.key}"
74 """Update the state of the entity."""
None __init__(self, SensorEntityDescription description, LookinData lookin_data)
None _handle_coordinator_update(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)