Skip to content

Commit

Permalink
Add support for the RDM004 wall switch from philips
Browse files Browse the repository at this point in the history
  • Loading branch information
aradar committed Mar 28, 2024
1 parent 9ccb69a commit ed518bf
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
46 changes: 46 additions & 0 deletions tests/test_philips.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Tests for Philips quirks."""

import pytest

import zhaquirks
import zhaquirks.philips.wall_switch

zhaquirks.setup()


@pytest.mark.parametrize(
"manufacturer,model",
[
("Philips", "RDM001"),
("Signify Netherlands B.V.", "RDM001"),
("Philips", "RDM004"),
("Signify Netherlands B.V.", "RDM004"),
],
)
def test_RDM_family_signature(
manufacturer: str, model: str, assert_signature_matches_quirk
) -> None:
"""Test that the signature of all supported RDM devices is matched to its quirk."""
signature = {
"node_descriptor": "<SimpleDescriptor endpoint=1 profile=260 device_type=2080 device_version=1 input_clusters=[0, 1, 3, 64512] output_clusters=[3, 4, 6, 8, 25]>",
"endpoints": {
"1": {
"profile_id": 260,
"device_type": "0x820",
"in_clusters": [
"0x0",
"0x1",
"0x3",
"0xFC00",
],
"out_clusters": ["0x3", "0x4", "0x6", "0x8", "0x19"],
}
},
"manufacturer": manufacturer,
"model": model,
"class": "zhaquirks.philips.wall_switch.PhilipsWallSwitch",
}

assert_signature_matches_quirk(
zhaquirks.philips.wall_switch.PhilipsWallSwitch, signature
)
13 changes: 9 additions & 4 deletions zhaquirks/philips/rdm001.py → zhaquirks/philips/wall_switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Signify RDM001 device."""
"""Signify wall switch devices (at the moment RDM001 and RDM004)."""

import logging
from typing import Any, Optional, Union
Expand Down Expand Up @@ -125,15 +125,20 @@ def handle_cluster_request(
self.listener_event(ZHA_SEND_EVENT, action, event_args)


class PhilipsROM001(CustomDevice):
"""Philips ROM001 device."""
class PhilipsWallSwitch(CustomDevice):
"""Philips RDM001 or RDM004 device."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=2080
# device_version=1
# input_clusters=[0, 1, 3, 64512]
# output_clusters=[3, 4, 6, 8, 25]>
MODELS_INFO: [(PHILIPS, "RDM001"), (SIGNIFY, "RDM001")],
MODELS_INFO: [
(PHILIPS, "RDM001"),
(SIGNIFY, "RDM001"),
(PHILIPS, "RDM004"),
(SIGNIFY, "RDM004"),
],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
Expand Down

0 comments on commit ed518bf

Please sign in to comment.