From 76cbfaedb527b16e3c27d7077b8c572ee703cbd0 Mon Sep 17 00:00:00 2001 From: Ralph Schlett Date: Wed, 27 Mar 2024 22:24:15 +0100 Subject: [PATCH 1/3] Add support for the RDM004 wall switch from philips --- zhaquirks/philips/{rdm001.py => wall_switch.py} | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) rename zhaquirks/philips/{rdm001.py => wall_switch.py} (91%) diff --git a/zhaquirks/philips/rdm001.py b/zhaquirks/philips/wall_switch.py similarity index 91% rename from zhaquirks/philips/rdm001.py rename to zhaquirks/philips/wall_switch.py index 86b7e4be91..751eec9689 100644 --- a/zhaquirks/philips/rdm001.py +++ b/zhaquirks/philips/wall_switch.py @@ -1,4 +1,4 @@ -"""Signify RDM001 device.""" +"""Signify wall switch devices (at the moment RDM001 and RDM004).""" from zigpy.profiles import zha from zigpy.quirks import CustomCluster, CustomDevice @@ -72,15 +72,20 @@ class PhilipsRdm001RemoteCluster(PhilipsRemoteCluster): ] -class PhilipsRDM001(CustomDevice): - """Philips RDM001 device.""" +class PhilipsWallSwitch(CustomDevice): + """Philips RDM001 or RDM004 device.""" signature = { # - MODELS_INFO: [(PHILIPS, "RDM001"), (SIGNIFY, "RDM001")], + MODELS_INFO: [ + (PHILIPS, "RDM001"), + (SIGNIFY, "RDM001"), + (PHILIPS, "RDM004"), + (SIGNIFY, "RDM004"), + ], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, From fe64adbc0ba8c557f126bfabc7a5cc222e695b5a Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Wed, 16 Oct 2024 04:43:19 +0200 Subject: [PATCH 2/3] Update comments --- zhaquirks/philips/wall_switch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zhaquirks/philips/wall_switch.py b/zhaquirks/philips/wall_switch.py index 751eec9689..8d7dfae81d 100644 --- a/zhaquirks/philips/wall_switch.py +++ b/zhaquirks/philips/wall_switch.py @@ -1,4 +1,4 @@ -"""Signify wall switch devices (at the moment RDM001 and RDM004).""" +"""Signify wall switch devices (RDM001 and RDM004).""" from zigpy.profiles import zha from zigpy.quirks import CustomCluster, CustomDevice @@ -83,7 +83,7 @@ class PhilipsWallSwitch(CustomDevice): MODELS_INFO: [ (PHILIPS, "RDM001"), (SIGNIFY, "RDM001"), - (PHILIPS, "RDM004"), + (PHILIPS, "RDM004"), # likely not needed (SIGNIFY, "RDM004"), ], ENDPOINTS: { From 1702bb87cb8c6f84b9dc9eb47970ff06943deb53 Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Wed, 16 Oct 2024 04:44:43 +0200 Subject: [PATCH 3/3] Fix tests --- tests/test_philips.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_philips.py b/tests/test_philips.py index 5f08f7b6e6..3fdebf00a4 100644 --- a/tests/test_philips.py +++ b/tests/test_philips.py @@ -32,11 +32,11 @@ ) import zhaquirks.philips from zhaquirks.philips import Button, ButtonPressQueue, PhilipsRemoteCluster, PressType -from zhaquirks.philips.rdm001 import PhilipsRDM001 from zhaquirks.philips.rdm002 import PhilipsRDM002 from zhaquirks.philips.rom001 import PhilipsROM001 from zhaquirks.philips.rwl022 import PhilipsRWL022 from zhaquirks.philips.rwlfirstgen import PhilipsRWLFirstGen, PhilipsRWLFirstGen2 +from zhaquirks.philips.wall_switch import PhilipsWallSwitch zhaquirks.setup() @@ -95,7 +95,7 @@ }, ), ( - [PhilipsRDM001], + [PhilipsWallSwitch], { (SHORT_PRESS, TURN_ON): {COMMAND: "left_press"}, (LONG_PRESS, TURN_ON): {COMMAND: "left_hold"}, @@ -331,7 +331,7 @@ def press(self, callback, button): "dev, ep, button, events", ( ( - PhilipsRDM001, + PhilipsWallSwitch, 1, "left", ["press", "short_release"], @@ -415,7 +415,7 @@ def test_PhilipsRemoteCluster_short_press( "on", ), ( - PhilipsRDM001, + PhilipsWallSwitch, 1, "left", ), @@ -490,7 +490,7 @@ def test_PhilipsRemoteCluster_multi_press( @pytest.mark.parametrize( "dev, ep", ( - (PhilipsRDM001, 1), + (PhilipsWallSwitch, 1), (PhilipsROM001, 1), (PhilipsRWLFirstGen, 2), (PhilipsRWLFirstGen2, 2), @@ -516,7 +516,7 @@ def test_PhilipsRemoteCluster_ignore_unknown_buttons(zigpy_device_from_quirk, de ( (PhilipsROM001, 1, "on", "hold", "long_release", "hold_release"), ( - PhilipsRDM001, + PhilipsWallSwitch, 1, "left", "hold",