From 2a8bc9bad38164c53583b18a225eeac9d1580e26 Mon Sep 17 00:00:00 2001 From: kongo09 Date: Sun, 3 Nov 2024 19:48:39 +0100 Subject: [PATCH] add new models AC3210, AC3220, AC3221 --- README.md | 5 + .../philips_airpurifier_coap/const.py | 3 + .../philips_airpurifier_coap/philips.py | 129 +++++++++++------- 3 files changed, 86 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 4e1e9e8..cf003fe 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ Note: `configuration.yaml` is no longer supported and your configuration is not ## Supported models +Note: Some of these models seem to have a newer firmware that does not allow local connections anymore. If you buy the device with the intention to manage it via Home Assistant, make sure you can return it, if the integration doesn't work for you. + - AC0850/11 AWS_Philips_AIR - AC0850/11 AWS_Philips_AIR_Combo - AC0850/20 AWS_Philips_AIR @@ -79,6 +81,9 @@ Note: `configuration.yaml` is no longer supported and your configuration is not - AC3039 - AC3055 - AC3059 +- AC3210 +- AC3220 +- AC3221 - AC3421 - AC3259 - AC3737 diff --git a/custom_components/philips_airpurifier_coap/const.py b/custom_components/philips_airpurifier_coap/const.py index fb55d4e..412541d 100644 --- a/custom_components/philips_airpurifier_coap/const.py +++ b/custom_components/philips_airpurifier_coap/const.py @@ -123,6 +123,9 @@ class FanModel(StrEnum): AC3039 = "AC3039" AC3055 = "AC3055" AC3059 = "AC3059" + AC3210 = "AC3210" + AC3220 = "AC3220" + AC3221 = "AC3221" AC3259 = "AC3259" AC3421 = "AC3421" AC3737 = "AC3737" diff --git a/custom_components/philips_airpurifier_coap/philips.py b/custom_components/philips_airpurifier_coap/philips.py index 79d3fae..6241efa 100644 --- a/custom_components/philips_airpurifier_coap/philips.py +++ b/custom_components/philips_airpurifier_coap/philips.py @@ -1223,6 +1223,78 @@ class PhilipsAC3059(PhilipsAC305x): """AC3059.""" +# this device seems similar to the AMF family +class PhilipsAC32xx(PhilipsNew2GenericCoAPFan): + """AC32xx family.""" + + AVAILABLE_PRESET_MODES = { + PresetMode.AUTO: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 0, + }, + PresetMode.MEDIUM: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 19, + }, + PresetMode.TURBO: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 18, + }, + PresetMode.SLEEP: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 17, + }, + } + AVAILABLE_SPEEDS = { + PresetMode.SPEED_1: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 1, + }, + PresetMode.SPEED_2: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 2, + }, + PresetMode.SPEED_3: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 3, + }, + PresetMode.SPEED_4: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 4, + }, + PresetMode.SPEED_5: { + PhilipsApi.NEW2_POWER: 1, + PhilipsApi.NEW2_MODE_B: 5, + }, + } + + AVAILABLE_LIGHTS = [PhilipsApi.NEW2_DISPLAY_BACKLIGHT3] + AVAILABLE_SWITCHES = [ + PhilipsApi.NEW2_CHILD_LOCK, + PhilipsApi.NEW2_BEEP, + PhilipsApi.NEW2_AUTO_PLUS_AI, + ] + AVAILABLE_SELECTS = [ + PhilipsApi.NEW2_TIMER2, + PhilipsApi.NEW2_LAMP_MODE, + PhilipsApi.NEW2_PREFERRED_INDEX, + ] + + +class PhilipsAC3210(PhilipsAC32xx): + """AC3210.""" + + AVAILABLE_SELECTS = [PhilipsApi.NEW_PREFERRED_INDEX] + + +class PhilipsAC3220(PhilipsAC3210): + """AC3220.""" + + +class PhilipsAC3221(PhilipsAC3210): + """AC3221.""" + + class PhilipsAC3259(PhilipsGenericCoAPFan): """AC3259.""" @@ -1577,58 +1649,10 @@ class PhilipsAC385886(PhilipsAC385x51): """AC3858/86.""" -# this device seems similar to the AMF family -class PhilipsAC4220(PhilipsNew2GenericCoAPFan): - """AC4220 family.""" - - AVAILABLE_PRESET_MODES = { - PresetMode.AUTO: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 0, - }, - PresetMode.MEDIUM: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 19, - }, - PresetMode.TURBO: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 18, - }, - PresetMode.SLEEP: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 17, - }, - } - AVAILABLE_SPEEDS = { - PresetMode.SPEED_1: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 1, - }, - PresetMode.SPEED_2: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 2, - }, - PresetMode.SPEED_3: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 3, - }, - PresetMode.SPEED_4: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 4, - }, - PresetMode.SPEED_5: { - PhilipsApi.NEW2_POWER: 1, - PhilipsApi.NEW2_MODE_B: 5, - }, - } +class PhilipsAC4220(PhilipsAC32xx): + """AC4220.""" - AVAILABLE_LIGHTS = [PhilipsApi.NEW2_DISPLAY_BACKLIGHT3] - AVAILABLE_SWITCHES = [ - PhilipsApi.NEW2_CHILD_LOCK, - PhilipsApi.NEW2_BEEP, - PhilipsApi.NEW2_AUTO_PLUS_AI, - ] - AVAILABLE_SELECTS = [PhilipsApi.NEW2_TIMER2, PhilipsApi.NEW2_LAMP_MODE] + AVAILABLE_SELECTS = [PhilipsApi.NEW2_GAS_PREFERRED_INDEX] class PhilipsAC4221(PhilipsAC4220): @@ -2048,6 +2072,9 @@ class PhilipsCX3550(PhilipsNew2GenericCoAPFan): FanModel.AC3039: PhilipsAC3039, FanModel.AC3055: PhilipsAC3055, FanModel.AC3059: PhilipsAC3059, + FanModel.AC3210: PhilipsAC3210, + FanModel.AC3220: PhilipsAC3220, + FanModel.AC3221: PhilipsAC3221, FanModel.AC3259: PhilipsAC3259, FanModel.AC3421: PhilipsAC3421, FanModel.AC3737: PhilipsAC3737,