Skip to content

Commit

Permalink
Merge pull request #232 from kongo09/230-amf870-preferred-index-value…
Browse files Browse the repository at this point in the history
…-is-incorrect

fix gas index map
  • Loading branch information
kongo09 authored Dec 20, 2024
2 parents 1ff1362 + 9adff4c commit e067f74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions custom_components/philips_airpurifier_coap/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/philips_airpurifier_coap/philips.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand Down

0 comments on commit e067f74

Please sign in to comment.