From f04164a5fc187f8784bb88c8ba13e6da817723aa Mon Sep 17 00:00:00 2001 From: Deehsiao Lew Date: Thu, 13 Aug 2026 00:50:35 +0800 Subject: [PATCH] feat: support the DYD-P40 Adds the fan-speed value this model reports and a product feature config for it. Without the enum member, every poll raises: ValueError: 5 is not a valid DeyeFanSpeed The enum member alone is not enough: the consumer maps state through ordered_list_item_to_percentage(feature_config["fan_speed"], ...), which raises for a speed absent from the product's list, and this product had no entry at all, so it inherited a default listing speeds 1-4. Every value below was measured against the appliance -- each property set and read back, baseline restored afterwards -- because the product catalogue carries no capability metadata: modes 1/2/3/4/6 accepted; 0 (MANUAL) and 5 rejected fan speeds 1/2/3/5 accepted; 4 (FULL) rejected humidity 40-70 accepted; 20/25/30/35 and 75/80/85/90 rejected anion NegativeIon settable -> present oscillating SwingingWind settable -> present water pump WaterPump 1 reads back 0 -> not present Note 4 is rejected while 5 is accepted, so 5 is not a step above FULL -- most likely an auto/smart speed. Named UNKNOWN_SPEED following the existing convention for unidentified values (DeyeDeviceMode already carries UNKNOWN_MODE and UNKNOWN_MODE_2); rename if you know what it is. --- src/libdeye/const.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libdeye/const.py b/src/libdeye/const.py index a092897..b62d1c9 100644 --- a/src/libdeye/const.py +++ b/src/libdeye/const.py @@ -29,6 +29,7 @@ class DeyeFanSpeed(IntEnum): MIDDLE = 2 HIGH = 3 FULL = 4 + UNKNOWN_SPEED = 5 class DeyeProductConfig(TypedDict): @@ -64,6 +65,26 @@ class DeyeProductPartialConfig(TypedDict, total=False): PRODUCT_FEATURE_CONFIG: dict[str, DeyeProductPartialConfig] = { + "d71936c6951c11f0a8200242ac480009": { # DYD-P40 + "mode": [ + DeyeDeviceMode.CLOTHES_DRYER_MODE, + DeyeDeviceMode.AIR_PURIFIER_MODE, + DeyeDeviceMode.AUTO_MODE, + DeyeDeviceMode.UNKNOWN_MODE, + DeyeDeviceMode.SLEEP_MODE, + ], + "fan_speed": [ + DeyeFanSpeed.LOW, + DeyeFanSpeed.MIDDLE, + DeyeFanSpeed.HIGH, + DeyeFanSpeed.UNKNOWN_SPEED, + ], + "min_target_humidity": 40, + "max_target_humidity": 70, + "anion": True, + "oscillating": True, + "water_pump": False, + }, "07dddba41c3011e8829100163e0f811e": { # 612S "mode": [], "fan_speed": [DeyeFanSpeed.LOW, DeyeFanSpeed.HIGH],