From 872d78bc73f608d5f293b8f13e75738881267085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Nenz=C3=A9n?= Date: Sun, 14 Jan 2024 22:51:43 +0100 Subject: [PATCH] Fallback to unknown filter type if not defined for A7 --- custom_components/wellbeing/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/wellbeing/api.py b/custom_components/wellbeing/api.py index 3915278..c2e71c5 100644 --- a/custom_components/wellbeing/api.py +++ b/custom_components/wellbeing/api.py @@ -124,12 +124,12 @@ def _create_entities(data): device_class=SensorDeviceClass.CO2 ), ApplianceSensor( - name=f"{FILTER_TYPE[data.get('FilterType_1', 0)]} Life", + name=f"{FILTER_TYPE.get(data.get('FilterType_1', 0), 'Unknown filter')} Life", attr='FilterLife_1', unit=PERCENTAGE ), ApplianceSensor( - name=f"{FILTER_TYPE[data.get('FilterType_2', 0)]} Life", + name=f"{FILTER_TYPE.get(data.get('FilterType_2', 0), 'Unknown filter')} Life", attr='FilterLife_2', unit=PERCENTAGE ), @@ -145,7 +145,7 @@ def _create_entities(data): a9_entities = [ ApplianceSensor( - name=f"{FILTER_TYPE.get(data.get('FilterType', 0), 'Filter')} Life", + name=f"{FILTER_TYPE.get(data.get('FilterType', 0), 'Unknown filter')} Life", attr='FilterLife', unit=PERCENTAGE ),