From 9adff4c1ff05a1f7ea015ce03d994943abdf82b6 Mon Sep 17 00:00:00 2001 From: kongo09 Date: Fri, 20 Dec 2024 14:15:42 +0100 Subject: [PATCH] fix gas index map --- custom_components/philips_airpurifier_coap/const.py | 13 +++++++++++-- .../philips_airpurifier_coap/philips.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/custom_components/philips_airpurifier_coap/const.py b/custom_components/philips_airpurifier_coap/const.py index 7a1ba37..a8ab18b 100644 --- a/custom_components/philips_airpurifier_coap/const.py +++ b/custom_components/philips_airpurifier_coap/const.py @@ -488,11 +488,20 @@ class PhilipsApi: "0": FanAttributes.INDOOR_ALLERGEN_INDEX, "1": FanAttributes.PM25, } + NEW2_PREFERRED_INDEX_MAP = { + 0: FanAttributes.INDOOR_ALLERGEN_INDEX, + 1: FanAttributes.PM25, + } GAS_PREFERRED_INDEX_MAP = { "0": FanAttributes.INDOOR_ALLERGEN_INDEX, "1": FanAttributes.PM25, "2": FanAttributes.GAS, } + NEW2_GAS_PREFERRED_INDEX_MAP = { + 0: FanAttributes.INDOOR_ALLERGEN_INDEX, + 1: FanAttributes.PM25, + 2: FanAttributes.GAS, + } NEW_PREFERRED_INDEX_MAP = { "IAI": FanAttributes.INDOOR_ALLERGEN_INDEX, "PM2.5": FanAttributes.PM25, @@ -921,7 +930,7 @@ class PhilipsApi: PhilipsApi.NEW2_PREFERRED_INDEX: { FanAttributes.LABEL: FanAttributes.PREFERRED_INDEX, CONF_ENTITY_CATEGORY: EntityCategory.CONFIG, - OPTIONS: PhilipsApi.PREFERRED_INDEX_MAP, + OPTIONS: PhilipsApi.NEW2_PREFERRED_INDEX_MAP, }, PhilipsApi.GAS_PREFERRED_INDEX: { FanAttributes.LABEL: FanAttributes.PREFERRED_INDEX, @@ -931,7 +940,7 @@ class PhilipsApi: PhilipsApi.NEW2_GAS_PREFERRED_INDEX: { FanAttributes.LABEL: FanAttributes.PREFERRED_INDEX, CONF_ENTITY_CATEGORY: EntityCategory.CONFIG, - OPTIONS: PhilipsApi.GAS_PREFERRED_INDEX_MAP, + OPTIONS: PhilipsApi.NEW2_GAS_PREFERRED_INDEX_MAP, }, PhilipsApi.NEW2_CIRCULATION: { FanAttributes.LABEL: FanAttributes.FUNCTION, diff --git a/custom_components/philips_airpurifier_coap/philips.py b/custom_components/philips_airpurifier_coap/philips.py index c19893f..7ff3b3f 100644 --- a/custom_components/philips_airpurifier_coap/philips.py +++ b/custom_components/philips_airpurifier_coap/philips.py @@ -489,7 +489,7 @@ class PhilipsNew2GenericFan(PhilipsGenericFanBase): ( FanAttributes.PREFERRED_INDEX, PhilipsApi.NEW2_GAS_PREFERRED_INDEX, - PhilipsApi.GAS_PREFERRED_INDEX_MAP, + PhilipsApi.NEW2_GAS_PREFERRED_INDEX_MAP, ), # device sensors (