From 5ed00658456e49da1b25500b1e535734bec5680d Mon Sep 17 00:00:00 2001 From: Jezza34000 <57314417+Jezza34000@users.noreply.github.com> Date: Thu, 7 Nov 2024 19:37:28 +0100 Subject: [PATCH] fix: KeyError: 'petName' --- custom_components/petkit/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/petkit/sensor.py b/custom_components/petkit/sensor.py index 3a6249d..12551fa 100644 --- a/custom_components/petkit/sensor.py +++ b/custom_components/petkit/sensor.py @@ -2817,7 +2817,7 @@ def result_to_description(self, event_type: int, record: dict[str, Any]) -> str: return description if event_type == 10: - if (record['petId'] == '-2') or (record['petId'] == '-1'): + if record["petId"] in ["-1", "-2", "-3"]: name = 'Unknown' else: name = record['petName']