From 4dfa2b8b88e7b7ff7402fc3efbe8d255e1611701 Mon Sep 17 00:00:00 2001 From: Nathan Spencer Date: Mon, 4 May 2026 14:51:17 -0600 Subject: [PATCH] Limit power status binary sensor to non-LR5 devices (#169659) --- .../components/litterrobot/binary_sensor.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/litterrobot/binary_sensor.py b/homeassistant/components/litterrobot/binary_sensor.py index 856820e9586a..dc7bcd5acc8b 100644 --- a/homeassistant/components/litterrobot/binary_sensor.py +++ b/homeassistant/components/litterrobot/binary_sensor.py @@ -6,7 +6,7 @@ from collections.abc import Callable from dataclasses import dataclass from typing import Generic -from pylitterbot import LitterRobot, LitterRobot4, Robot +from pylitterbot import FeederRobot, LitterRobot, LitterRobot3, LitterRobot4, Robot from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, @@ -32,8 +32,11 @@ class RobotBinarySensorEntityDescription( is_on_fn: Callable[[_WhiskerEntityT], bool] -BINARY_SENSOR_MAP: dict[type[Robot], tuple[RobotBinarySensorEntityDescription, ...]] = { - LitterRobot: ( # type: ignore[type-abstract] # only used for isinstance check +BINARY_SENSOR_MAP: dict[ + type[Robot] | tuple[type[Robot], ...], + tuple[RobotBinarySensorEntityDescription, ...], +] = { + LitterRobot: ( RobotBinarySensorEntityDescription[LitterRobot]( key="sleeping", translation_key="sleeping", @@ -58,8 +61,8 @@ BINARY_SENSOR_MAP: dict[type[Robot], tuple[RobotBinarySensorEntityDescription, . is_on_fn=lambda robot: not robot.is_hopper_removed, ), ), - Robot: ( # type: ignore[type-abstract] # only used for isinstance check - RobotBinarySensorEntityDescription[Robot]( + (FeederRobot, LitterRobot3, LitterRobot4): ( + RobotBinarySensorEntityDescription[FeederRobot | LitterRobot3 | LitterRobot4]( key="power_status", translation_key="power_status", device_class=BinarySensorDeviceClass.PLUG,