1 """Litter-Robot entities for common data and methods."""
3 from __future__
import annotations
5 from typing
import Generic, TypeVar
7 from pylitterbot
import Robot
8 from pylitterbot.robot
import EVENT_UPDATE
14 DataUpdateCoordinator,
17 from .const
import DOMAIN
18 from .hub
import LitterRobotHub
20 _RobotT = TypeVar(
"_RobotT", bound=Robot)
24 CoordinatorEntity[DataUpdateCoordinator[bool]], Generic[_RobotT]
26 """Generic Litter-Robot entity representing common data and methods."""
28 _attr_has_entity_name =
True
31 self, robot: _RobotT, hub: LitterRobotHub, description: EntityDescription
33 """Pass coordinator to CoordinatorEntity."""
42 """Return the device information for a Litter-Robot."""
43 assert self.
robotrobot.serial
45 identifiers={(DOMAIN, self.
robotrobot.serial)},
46 manufacturer=
"Litter-Robot",
47 model=self.
robotrobot.model,
48 name=self.
robotrobot.name,
49 sw_version=getattr(self.
robotrobot,
"firmware",
None),
53 """Set up a listener for the entity."""
55 self.async_on_remove(self.
robotrobot.on(EVENT_UPDATE, self.async_write_ha_state))
None async_added_to_hass(self)
None __init__(self, _RobotT robot, LitterRobotHub hub, EntityDescription description)
DeviceInfo device_info(self)