From 8cc15e82df21b390d8f68d3de72e8e1014382353 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 29 May 2024 21:09:50 +0200 Subject: [PATCH] Fix light discovery for Matter dimmable plugin unit (#118404) --- homeassistant/components/matter/light.py | 1 + .../fixtures/nodes/dimmable-plugin-unit.json | 502 ++++++++++++++++++ tests/components/matter/test_light.py | 1 + 3 files changed, 504 insertions(+) create mode 100644 tests/components/matter/fixtures/nodes/dimmable-plugin-unit.json diff --git a/homeassistant/components/matter/light.py b/homeassistant/components/matter/light.py index acd85884875..89400c98989 100644 --- a/homeassistant/components/matter/light.py +++ b/homeassistant/components/matter/light.py @@ -435,6 +435,7 @@ DISCOVERY_SCHEMAS = [ device_type=( device_types.ColorTemperatureLight, device_types.DimmableLight, + device_types.DimmablePlugInUnit, device_types.ExtendedColorLight, device_types.OnOffLight, ), diff --git a/tests/components/matter/fixtures/nodes/dimmable-plugin-unit.json b/tests/components/matter/fixtures/nodes/dimmable-plugin-unit.json new file mode 100644 index 00000000000..5b1e1cfaba6 --- /dev/null +++ b/tests/components/matter/fixtures/nodes/dimmable-plugin-unit.json @@ -0,0 +1,502 @@ +{ + "node_id": 36, + "date_commissioned": "2024-05-18T13:06:23.766788", + "last_interview": "2024-05-18T13:06:23.766793", + "interview_version": 6, + "available": true, + "is_bridge": false, + "attributes": { + "0/29/0": [ + { + "0": 22, + "1": 1 + } + ], + "0/29/1": [29, 31, 40, 42, 43, 44, 48, 49, 50, 51, 52, 54, 60, 62, 63], + "0/29/2": [41], + "0/29/3": [1], + "0/29/65532": 0, + "0/29/65533": 1, + "0/29/65528": [], + "0/29/65529": [], + "0/29/65531": [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533], + "0/31/0": [ + { + "1": 5, + "2": 2, + "3": [112233], + "4": null, + "254": 2 + } + ], + "0/31/1": [], + "0/31/2": 4, + "0/31/3": 3, + "0/31/4": 3, + "0/31/65532": 0, + "0/31/65533": 1, + "0/31/65528": [], + "0/31/65529": [], + "0/31/65531": [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533], + "0/40/0": 1, + "0/40/1": "Matter", + "0/40/2": 4251, + "0/40/3": "Dimmable Plugin Unit", + "0/40/4": 4098, + "0/40/5": "", + "0/40/6": "", + "0/40/7": 1, + "0/40/8": "1.0", + "0/40/9": 131365, + "0/40/10": "2.1.25", + "0/40/15": "1000_0030_D228", + "0/40/18": "E2B4285EEDD3A387", + "0/40/19": { + "0": 3, + "1": 3 + }, + "0/40/65532": 0, + "0/40/65533": 1, + "0/40/65528": [], + "0/40/65529": [], + "0/40/65531": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 18, 19, 65528, 65529, 65531, 65532, + 65533 + ], + "0/42/0": [], + "0/42/1": true, + "0/42/2": 1, + "0/42/3": null, + "0/42/65532": 0, + "0/42/65533": 1, + "0/42/65528": [], + "0/42/65529": [0], + "0/42/65531": [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533], + "0/43/0": "en-US", + "0/43/1": [ + "en-US", + "de-DE", + "fr-FR", + "en-GB", + "es-ES", + "zh-CN", + "it-IT", + "ja-JP" + ], + "0/43/65532": 0, + "0/43/65533": 1, + "0/43/65528": [], + "0/43/65529": [], + "0/43/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], + "0/44/0": 0, + "0/44/1": 0, + "0/44/2": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 7], + "0/44/65532": 0, + "0/44/65533": 1, + "0/44/65528": [], + "0/44/65529": [], + "0/44/65531": [0, 1, 2, 65528, 65529, 65531, 65532, 65533], + "0/48/0": 0, + "0/48/1": { + "0": 60, + "1": 900 + }, + "0/48/2": 0, + "0/48/3": 0, + "0/48/4": true, + "0/48/65532": 0, + "0/48/65533": 1, + "0/48/65528": [1, 3, 5], + "0/48/65529": [0, 2, 4], + "0/48/65531": [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533], + "0/49/0": 1, + "0/49/1": [ + { + "0": "", + "1": true + } + ], + "0/49/2": 10, + "0/49/3": 20, + "0/49/4": true, + "0/49/5": 0, + "0/49/6": "", + "0/49/7": null, + "0/49/65532": 1, + "0/49/65533": 1, + "0/49/65528": [1, 5, 7], + "0/49/65529": [0, 2, 4, 6, 8], + "0/49/65531": [0, 1, 2, 3, 4, 5, 6, 7, 65528, 65529, 65531, 65532, 65533], + "0/50/65532": 0, + "0/50/65533": 1, + "0/50/65528": [1], + "0/50/65529": [0], + "0/50/65531": [65528, 65529, 65531, 65532, 65533], + "0/51/0": [ + { + "0": "r0", + "1": true, + "2": null, + "3": null, + "4": "AAemN9h0", + "5": ["wKhr7Q=="], + "6": ["/oAAAAAAAAACB6b//jfYdA=="], + "7": 1 + } + ], + "0/51/1": 2, + "0/51/2": 86407, + "0/51/3": 24, + "0/51/4": 0, + "0/51/5": [], + "0/51/6": [], + "0/51/7": [], + "0/51/8": false, + "0/51/65532": 0, + "0/51/65533": 1, + "0/51/65528": [], + "0/51/65529": [0], + "0/51/65531": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 65528, 65529, 65531, 65532, 65533 + ], + "0/52/0": [ + { + "0": 26, + "1": "Logging~", + "2": 16224, + "3": 4056, + "4": 16352 + }, + { + "0": 26, + "1": "Logging", + "2": 16224, + "3": 4056, + "4": 16352 + }, + { + "0": 34, + "1": "cnR3X3JlY5c=", + "2": 5560, + "3": 862, + "4": 5856 + }, + { + "0": 36, + "1": "rtw_intz", + "2": 832, + "3": 200, + "4": 992 + }, + { + "0": 14, + "1": "interacZ", + "2": 4784, + "3": 1090, + "4": 5088 + }, + { + "0": 37, + "1": "cmd_thr", + "2": 3880, + "3": 718, + "4": 4064 + }, + { + "0": 4, + "1": "LOGUART\u0010", + "2": 3896, + "3": 974, + "4": 4064 + }, + { + "0": 3, + "1": "log_ser\n", + "2": 4968, + "3": 1242, + "4": 5088 + }, + { + "0": 35, + "1": "rtw_xmi\u0014", + "2": 840, + "3": 168, + "4": 992 + }, + { + "0": 49, + "1": "mesh_pr", + "2": 680, + "3": 42, + "4": 992 + }, + { + "0": 47, + "1": "BLE_app", + "2": 4864, + "3": 1112, + "4": 5088 + }, + { + "0": 44, + "1": "trace_t", + "2": 280, + "3": 68, + "4": 480 + }, + { + "0": 45, + "1": "UpperSt", + "2": 2904, + "3": 620, + "4": 3040 + }, + { + "0": 46, + "1": "HCI I/F", + "2": 1800, + "3": 356, + "4": 2016 + }, + { + "0": 8, + "1": "Tmr Svc", + "2": 3940, + "3": 933, + "4": 4076 + }, + { + "0": 38, + "1": "lev_snt", + "2": 3960, + "3": 930, + "4": 4064 + }, + { + "0": 27, + "1": "iot_thr", + "2": 7968, + "3": 1984, + "4": 8160 + }, + { + "0": 28, + "1": "iot_thr", + "2": 7968, + "3": 1984, + "4": 8160 + }, + { + "0": 2, + "1": "lev_hea", + "2": 3824, + "3": 831, + "4": 4064 + }, + { + "0": 23, + "1": "Wifi_Co", + "2": 7872, + "3": 1879, + "4": 8160 + }, + { + "0": 40, + "1": "lev_ota", + "2": 7896, + "3": 1442, + "4": 8160 + }, + { + "0": 39, + "1": "Schedul", + "2": 1696, + "3": 404, + "4": 2016 + }, + { + "0": 29, + "1": "AWS_MQT", + "2": 7832, + "3": 1824, + "4": 8160 + }, + { + "0": 41, + "1": "lev_net", + "2": 7768, + "3": 1788, + "4": 8160 + }, + { + "0": 18, + "1": "Lev_Tim", + "2": 3976, + "3": 948, + "4": 4064 + }, + { + "0": 1, + "1": "WATCHDO", + "2": 888, + "3": 212, + "4": 992 + }, + { + "0": 9, + "1": "TCP_IP", + "2": 3808, + "3": 644, + "4": 3968 + }, + { + "0": 50, + "1": "Bluetoo", + "2": 8000, + "3": 1990, + "4": 8160 + }, + { + "0": 20, + "1": "SHADOW_", + "2": 3736, + "3": 924, + "4": 4064 + }, + { + "0": 17, + "1": "NV_PROP", + "2": 1824, + "3": 446, + "4": 2016 + }, + { + "0": 16, + "1": "DIM_TAS", + "2": 1920, + "3": 460, + "4": 2016 + }, + { + "0": 19, + "1": "Lev_But", + "2": 3872, + "3": 956, + "4": 4064 + }, + { + "0": 7, + "1": "IDLE", + "2": 1944, + "3": 478, + "4": 2040 + }, + { + "0": 51, + "1": "CHIP", + "2": 6840, + "3": 1126, + "4": 8160 + } + ], + "0/52/1": 62880, + "0/52/2": 249440, + "0/52/3": 259456, + "0/52/65532": 1, + "0/52/65533": 1, + "0/52/65528": [], + "0/52/65529": [0], + "0/52/65531": [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533], + "0/54/0": "", + "0/54/1": 4, + "0/54/2": 3, + "0/54/3": 11, + "0/54/4": -66, + "0/54/65532": 0, + "0/54/65533": 1, + "0/54/65528": [], + "0/54/65529": [], + "0/54/65531": [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533], + "0/60/0": 0, + "0/60/1": null, + "0/60/2": null, + "0/60/65532": 0, + "0/60/65533": 1, + "0/60/65528": [], + "0/60/65529": [0, 1, 2], + "0/60/65531": [0, 1, 2, 65528, 65529, 65531, 65532, 65533], + "0/62/2": 5, + "0/62/3": 2, + "0/62/5": 2, + "0/62/65532": 0, + "0/62/65533": 1, + "0/62/65528": [1, 3, 5, 8], + "0/62/65529": [0, 2, 4, 6, 7, 9, 10, 11], + "0/62/65531": [0, 1, 2, 3, 4, 5, 65528, 65529, 65531, 65532, 65533], + "0/63/0": [], + "0/63/1": [], + "0/63/2": 3, + "0/63/3": 3, + "0/63/65532": 0, + "0/63/65533": 1, + "0/63/65528": [2, 5], + "0/63/65529": [0, 1, 3, 4], + "0/63/65531": [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533], + "1/3/0": 0, + "1/3/1": 2, + "1/3/65532": 0, + "1/3/65533": 4, + "1/3/65528": [], + "1/3/65529": [0, 64], + "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], + "1/4/0": 128, + "1/4/65532": 1, + "1/4/65533": 4, + "1/4/65528": [0, 1, 2, 3], + "1/4/65529": [0, 1, 2, 3, 4, 5], + "1/4/65531": [0, 65528, 65529, 65531, 65532, 65533], + "1/6/0": true, + "1/6/16384": true, + "1/6/16385": 0, + "1/6/16386": 0, + "1/6/16387": null, + "1/6/65532": 1, + "1/6/65533": 4, + "1/6/65528": [], + "1/6/65529": [0, 1, 2, 64, 65, 66], + "1/6/65531": [ + 0, 16384, 16385, 16386, 16387, 65528, 65529, 65531, 65532, 65533 + ], + "1/8/0": 254, + "1/8/1": 0, + "1/8/2": 1, + "1/8/3": 254, + "1/8/15": 0, + "1/8/16": 10, + "1/8/17": null, + "1/8/20": 50, + "1/8/16384": null, + "1/8/65532": 3, + "1/8/65533": 5, + "1/8/65528": [], + "1/8/65529": [0, 1, 2, 3, 4, 5, 6, 7], + "1/8/65531": [ + 0, 1, 2, 3, 15, 16, 17, 20, 16384, 65528, 65529, 65531, 65532, 65533 + ], + "1/29/0": [ + { + "0": 267, + "1": 1 + } + ], + "1/29/1": [3, 4, 6, 8, 29], + "1/29/2": [], + "1/29/3": [], + "1/29/65532": 0, + "1/29/65533": 1, + "1/29/65528": [], + "1/29/65529": [], + "1/29/65531": [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533] + }, + "attribute_subscriptions": [] +} diff --git a/tests/components/matter/test_light.py b/tests/components/matter/test_light.py index 775790701d1..2589e041b3b 100644 --- a/tests/components/matter/test_light.py +++ b/tests/components/matter/test_light.py @@ -116,6 +116,7 @@ async def test_light_turn_on_off( ("extended-color-light", "light.mock_extended_color_light"), ("color-temperature-light", "light.mock_color_temperature_light"), ("dimmable-light", "light.mock_dimmable_light"), + ("dimmable-plugin-unit", "light.dimmable_plugin_unit"), ], ) async def test_dimmable_light(