From 3fba83d37c3c72cf8feca0d44d7b694a25a6f880 Mon Sep 17 00:00:00 2001 From: Jezza34000 <57314417+Jezza34000@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:38:47 +0100 Subject: [PATCH] :bug: fix for DrinkTimes sensors --- custom_components/petkit/sensor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/petkit/sensor.py b/custom_components/petkit/sensor.py index 17b014a..6f9818a 100644 --- a/custom_components/petkit/sensor.py +++ b/custom_components/petkit/sensor.py @@ -449,7 +449,11 @@ class PetKitSensorDesc(PetKitDescSensorBase, SensorEntityDescription): translation_key="drink_times", entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, - value=lambda device: (len(device.device_records)), + value=lambda device: ( + len(device.device_records) + if isinstance(device.device_records, list) + else None + ), ), ], Pet: [