1 """The Litter-Robot integration."""
3 from __future__
import annotations
5 from pylitterbot
import FeederRobot, LitterRobot, LitterRobot3, LitterRobot4, Robot
12 from .const
import DOMAIN
13 from .hub
import LitterRobotHub
15 type LitterRobotConfigEntry = ConfigEntry[LitterRobotHub]
19 Platform.BINARY_SENSOR,
24 LitterRobot: (Platform.VACUUM,),
25 LitterRobot3: (Platform.BUTTON, Platform.TIME),
26 LitterRobot4: (Platform.UPDATE,),
27 FeederRobot: (Platform.BUTTON,),
32 """Get platforms for robots."""
36 for robot_type, platforms
in PLATFORMS_BY_TYPE.items()
37 if isinstance(robot, robot_type)
38 for platform
in platforms
43 """Set up Litter-Robot from a config entry."""
45 await hub.login(load_robots=
True, subscribe_for_updates=
True)
46 entry.runtime_data = hub
49 await hass.config_entries.async_forward_entry_setups(entry, platforms)
54 hass: HomeAssistant, entry: LitterRobotConfigEntry
56 """Unload a config entry."""
57 await entry.runtime_data.account.disconnect()
60 return await hass.config_entries.async_unload_platforms(entry, platforms)
64 hass: HomeAssistant, entry: LitterRobotConfigEntry, device_entry: DeviceEntry
66 """Remove a config entry from a device."""
69 for identifier
in device_entry.identifiers
70 if identifier[0] == DOMAIN
71 for robot
in entry.runtime_data.account.robots
72 if robot.serial == identifier[1]
set[Platform] get_platforms_for_robots(list[Robot] robots)
bool async_unload_entry(HomeAssistant hass, LitterRobotConfigEntry entry)
bool async_remove_config_entry_device(HomeAssistant hass, LitterRobotConfigEntry entry, DeviceEntry device_entry)
bool async_setup_entry(HomeAssistant hass, LitterRobotConfigEntry entry)