From 4c4d59fe6c6b8fc919a145b4099661712fa78cd8 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 3 Dec 2025 15:36:06 +0100 Subject: [PATCH 01/11] Clusters are matched on name, so ensure names suffixed by client --- tests/data/devices/lumi-lumi-remote-cagl02.json | 14 -------------- tests/data/devices/lumi-lumi-sensor-86sw2.json | 14 -------------- tests/data/devices/lumi-lumi-vibration-aq1.json | 14 -------------- .../devices/somfy-sonesse-28-wf-li-ion-roller.json | 14 -------------- tests/data/devices/third-reality-inc-3rss007z.json | 4 ++-- zha/application/platforms/update.py | 10 +++++----- zha/zigbee/cluster_handlers/__init__.py | 5 +++++ zha/zigbee/cluster_handlers/const.py | 2 +- 8 files changed, 13 insertions(+), 64 deletions(-) diff --git a/tests/data/devices/lumi-lumi-remote-cagl02.json b/tests/data/devices/lumi-lumi-remote-cagl02.json index abf43354c..d3acebdda 100644 --- a/tests/data/devices/lumi-lumi-remote-cagl02.json +++ b/tests/data/devices/lumi-lumi-remote-cagl02.json @@ -440,20 +440,6 @@ "enabled": true, "primary": false, "cluster_handlers": [ - { - "class_name": "OtaClusterHandler", - "generic_id": "cluster_handler_0x0019", - "endpoint_id": 1, - "cluster": { - "id": 25, - "name": "Ota", - "type": "server" - }, - "id": "1:0x0019", - "unique_id": "54:ef:44:10:00:14:f3:e7:1:0x0019", - "status": "INITIALIZED", - "value_attribute": null - }, { "class_name": "OtaClientClusterHandler", "generic_id": "cluster_handler_0x0019_client", diff --git a/tests/data/devices/lumi-lumi-sensor-86sw2.json b/tests/data/devices/lumi-lumi-sensor-86sw2.json index 052d50b38..7710441b2 100644 --- a/tests/data/devices/lumi-lumi-sensor-86sw2.json +++ b/tests/data/devices/lumi-lumi-sensor-86sw2.json @@ -587,20 +587,6 @@ "enabled": true, "primary": false, "cluster_handlers": [ - { - "class_name": "OtaClusterHandler", - "generic_id": "cluster_handler_0x0019", - "endpoint_id": 1, - "cluster": { - "id": 25, - "name": "Ota", - "type": "server" - }, - "id": "1:0x0019", - "unique_id": "00:15:8d:00:02:54:cb:fa:1:0x0019", - "status": "INITIALIZED", - "value_attribute": null - }, { "class_name": "OtaClientClusterHandler", "generic_id": "cluster_handler_0x0019_client", diff --git a/tests/data/devices/lumi-lumi-vibration-aq1.json b/tests/data/devices/lumi-lumi-vibration-aq1.json index e5163fe1d..59faed8ed 100644 --- a/tests/data/devices/lumi-lumi-vibration-aq1.json +++ b/tests/data/devices/lumi-lumi-vibration-aq1.json @@ -575,20 +575,6 @@ "enabled": true, "primary": false, "cluster_handlers": [ - { - "class_name": "OtaClusterHandler", - "generic_id": "cluster_handler_0x0019", - "endpoint_id": 1, - "cluster": { - "id": 25, - "name": "Ota", - "type": "server" - }, - "id": "1:0x0019", - "unique_id": "00:15:8d:00:02:af:97:27:1:0x0019", - "status": "INITIALIZED", - "value_attribute": null - }, { "class_name": "OtaClientClusterHandler", "generic_id": "cluster_handler_0x0019_client", diff --git a/tests/data/devices/somfy-sonesse-28-wf-li-ion-roller.json b/tests/data/devices/somfy-sonesse-28-wf-li-ion-roller.json index 4b131ab14..250afaa1e 100644 --- a/tests/data/devices/somfy-sonesse-28-wf-li-ion-roller.json +++ b/tests/data/devices/somfy-sonesse-28-wf-li-ion-roller.json @@ -585,20 +585,6 @@ "enabled": true, "primary": false, "cluster_handlers": [ - { - "class_name": "OtaClusterHandler", - "generic_id": "cluster_handler_0x0019", - "endpoint_id": 232, - "cluster": { - "id": 25, - "name": "Ota", - "type": "server" - }, - "id": "232:0x0019", - "unique_id": "ab:cd:ef:12:7b:7c:3f:a7:232:0x0019", - "status": "INITIALIZED", - "value_attribute": null - }, { "class_name": "OtaClientClusterHandler", "generic_id": "cluster_handler_0x0019_client", diff --git a/tests/data/devices/third-reality-inc-3rss007z.json b/tests/data/devices/third-reality-inc-3rss007z.json index c4b6c062f..8989953cf 100644 --- a/tests/data/devices/third-reality-inc-3rss007z.json +++ b/tests/data/devices/third-reality-inc-3rss007z.json @@ -291,7 +291,7 @@ "unique_id": "28:2c:02:bf:ff:e0:16:01-1-25-firmware_update", "migrate_unique_ids": [], "platform": "update", - "class_name": "FirmwareUpdateEntity", + "class_name": "FirmwareUpdateServerEntity", "translation_key": null, "translation_placeholders": null, "device_class": "firmware", @@ -323,7 +323,7 @@ "supported_features": 7 }, "state": { - "class_name": "FirmwareUpdateEntity", + "class_name": "FirmwareUpdateServerEntity", "available": true, "installed_version": null, "in_progress": false, diff --git a/zha/application/platforms/update.py b/zha/application/platforms/update.py index 7c2bedd9b..7da9e7f5d 100644 --- a/zha/application/platforms/update.py +++ b/zha/application/platforms/update.py @@ -21,7 +21,7 @@ from zha.zigbee.cluster_handlers.const import ( CLUSTER_HANDLER_ATTRIBUTE_UPDATED, CLUSTER_HANDLER_OTA, - CLUSTER_HANDLER_OTA_SERVER, + CLIENT_CLUSTER_HANDLER_OTA, ) from zha.zigbee.endpoint import Endpoint @@ -265,7 +265,7 @@ async def on_remove(self) -> None: await super().on_remove() -@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA) +@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_OTA) class FirmwareUpdateEntity(BaseFirmwareUpdateEntity): """Representation of a ZHA firmware update entity.""" @@ -282,7 +282,7 @@ def __init__( super().__init__(cluster_handlers, endpoint, device, **kwargs) self._ota_cluster_handler: ClusterHandler = self.cluster_handlers[ - CLUSTER_HANDLER_OTA + CLIENT_CLUSTER_HANDLER_OTA ] self._attr_installed_version: str | None = self._get_cluster_version() self._compatible_images: OtaImagesResult = OtaImagesResult( @@ -312,7 +312,7 @@ def _get_cluster_version(self) -> str | None: return None -@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA_SERVER) +@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA) class FirmwareUpdateServerEntity(BaseFirmwareUpdateEntity): """Representation of a ZHA firmware update entity.""" @@ -330,7 +330,7 @@ def __init__( # Some devices make it a server cluster, not a client cluster... self._ota_cluster_handler: ClusterHandler = self.cluster_handlers[ - CLUSTER_HANDLER_OTA_SERVER + CLUSTER_HANDLER_OTA ] self._attr_installed_version: str | None = self._get_cluster_version() self._compatible_images: OtaImagesResult = OtaImagesResult( diff --git a/zha/zigbee/cluster_handlers/__init__.py b/zha/zigbee/cluster_handlers/__init__.py index 0f5c95b0d..45aeb386f 100644 --- a/zha/zigbee/cluster_handlers/__init__.py +++ b/zha/zigbee/cluster_handlers/__init__.py @@ -731,6 +731,11 @@ def __init__(self, *args, **kwargs) -> None: self._generic_id += "_client" self._id += "_client" + @functools.cached_property + def name(self) -> str: + """Return friendly name.""" + return self.cluster.ep_attribute + "_client" or self._generic_id + def attribute_updated(self, attrid: int, value: Any, timestamp: datetime) -> None: """Handle an attribute updated on this cluster.""" super().attribute_updated(attrid, value, timestamp) diff --git a/zha/zigbee/cluster_handlers/const.py b/zha/zigbee/cluster_handlers/const.py index 5cdae12c7..0f5b1c3d1 100644 --- a/zha/zigbee/cluster_handlers/const.py +++ b/zha/zigbee/cluster_handlers/const.py @@ -68,7 +68,6 @@ CLUSTER_HANDLER_OCCUPANCY: Final[str] = "occupancy" CLUSTER_HANDLER_ON_OFF: Final[str] = "on_off" CLUSTER_HANDLER_OTA: Final[str] = "ota" -CLUSTER_HANDLER_OTA_SERVER: Final[str] = "ota_server" CLUSTER_HANDLER_POWER_CONFIGURATION: Final[str] = "power" CLUSTER_HANDLER_PRESSURE: Final[str] = "pressure" CLUSTER_HANDLER_SHADE: Final[str] = "shade" @@ -81,6 +80,7 @@ ZONE: Final[str] = CLUSTER_HANDLER_ZONE CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster" +CLIENT_CLUSTER_HANDLER_OTA: Final[str] = CLUSTER_HANDLER_OTA + "_client" AQARA_OPPLE_CLUSTER: Final[int] = 0xFCC0 IKEA_AIR_PURIFIER_CLUSTER: Final[int] = 0xFC7D IKEA_REMOTE_CLUSTER: Final[int] = 0xFC80 From 1ede699022f36132247b859fc7a6ab5ed31c2eae Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 3 Dec 2025 15:38:05 +0100 Subject: [PATCH 02/11] Adds LevelControl event entities for client clusters - Add event entities for LevelControl client clusters - Adjust registries to support ClientCluster handlers --- tests/data/devices/awox-tlsr82xx.json | 43 +++ tests/data/devices/hobeian-zg-101zl.json | 45 +++- .../ikea-of-sweden-remote-control-n2.json | 43 +++ .../devices/ikea-of-sweden-rodret-dimmer.json | 43 +++ ...ikea-of-sweden-rodret-wireless-dimmer.json | 43 +++ ...ikea-of-sweden-somrig-shortcut-button.json | 84 ++++++ ...of-sweden-symfonisk-sound-remote-gen2.json | 43 +++ .../ikea-of-sweden-tradfri-on-off-switch.json | 43 +++ ...ikea-of-sweden-tradfri-remote-control.json | 43 +++ ...kea-of-sweden-tradfri-wireless-dimmer.json | 43 +++ tests/data/devices/inovelli-vzm30-sn.json | 86 +++++- tests/data/devices/inovelli-vzm31-sn.json | 45 +++- tests/data/devices/inovelli-vzm35-sn.json | 45 +++- tests/data/devices/jasco-products-45857.json | 45 +++- .../data/devices/lds-zbt-cctswitch-d0001.json | 43 +++ .../legrand-double-gangs-remote-switch.json | 84 ++++++ .../data/devices/lk-zbt-dimswitch-d0001.json | 43 +++ .../devices/lumi-lumi-remote-b286opcn01.json | 43 +++ .../devices/lumi-lumi-remote-b486opcn01.json | 43 +++ .../devices/lumi-lumi-remote-b686opcn01.json | 43 +++ .../data/devices/lumi-lumi-sensor-switch.json | 43 +++ .../devices/lutron-lzl4bwhl01-remote.json | 43 +++ tests/data/devices/lutron-z3-1brl.json | 43 +++ .../data/devices/mli-zbt-remote-all-rgbw.json | 43 +++ .../neuhaus-lighting-group-nlg-remote.json | 43 +++ .../devices/osram-switch-4x-lightify.json | 248 ++++++++++++++++++ tests/data/devices/philips-rom001.json | 43 +++ tests/data/devices/philips-rwl020.json | 43 +++ .../signify-netherlands-b-v-rdm001.json | 43 +++ .../signify-netherlands-b-v-rdm002.json | 43 +++ .../signify-netherlands-b-v-rwl022.json | 43 +++ .../devices/third-reality-inc-3rsb22bz.json | 43 +++ .../data/devices/tz3000-gwkzibhs-ts004f.json | 43 +++ .../data/devices/tz3000-kjfzuycl-ts004f.json | 43 +++ .../data/devices/tz3000-xa9g7rxs-ts1002.json | 43 +++ tests/test_platform_event.py | 96 +++++++ zha/application/discovery.py | 34 ++- zha/application/platforms/event.py | 119 +++++++++ zha/application/registries.py | 1 + zha/zigbee/cluster_handlers/const.py | 3 + zha/zigbee/cluster_handlers/general.py | 31 ++- 41 files changed, 2114 insertions(+), 13 deletions(-) create mode 100644 tests/test_platform_event.py create mode 100644 zha/application/platforms/event.py diff --git a/tests/data/devices/awox-tlsr82xx.json b/tests/data/devices/awox-tlsr82xx.json index 686133fdf..9e36e61e3 100644 --- a/tests/data/devices/awox-tlsr82xx.json +++ b/tests/data/devices/awox-tlsr82xx.json @@ -199,6 +199,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "a4:c1:38:01:9c:d6:df:d1-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "a4:c1:38:01:9c:d6:df:d1:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "a4:c1:38:01:9c:d6:df:d1", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/hobeian-zg-101zl.json b/tests/data/devices/hobeian-zg-101zl.json index 032d3df28..de900222c 100644 --- a/tests/data/devices/hobeian-zg-101zl.json +++ b/tests/data/devices/hobeian-zg-101zl.json @@ -390,6 +390,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:41:15:95:9c-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:41:15:95:9c:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:41:15:95:9c", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "select": [ { "info_object": { @@ -596,7 +639,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-remote-control-n2.json b/tests/data/devices/ikea-of-sweden-remote-control-n2.json index f936d5f78..a2d66b903 100644 --- a/tests/data/devices/ikea-of-sweden-remote-control-n2.json +++ b/tests/data/devices/ikea-of-sweden-remote-control-n2.json @@ -194,6 +194,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6b:e7:d0:70-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:6b:e7:d0:70:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6b:e7:d0:70", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-rodret-dimmer.json b/tests/data/devices/ikea-of-sweden-rodret-dimmer.json index 078a11f25..1823904e0 100644 --- a/tests/data/devices/ikea-of-sweden-rodret-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-rodret-dimmer.json @@ -243,6 +243,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "5c:c7:c1:ff:fe:cc:19:d9-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "5c:c7:c1:ff:fe:cc:19:d9:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "5c:c7:c1:ff:fe:cc:19:d9", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json b/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json index f36a4e708..9f6cbd8dd 100644 --- a/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json @@ -260,6 +260,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:07:f8:aa:b7-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:07:f8:aa:b7:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:07:f8:aa:b7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json b/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json index 08224cbff..87625f569 100644 --- a/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json +++ b/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json @@ -321,6 +321,90 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6d:e6:02:47-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:6d:e6:02:47:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6d:e6:02:47", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6d:e6:02:47-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "ab:cd:ef:12:6d:e6:02:47:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6d:e6:02:47", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json b/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json index 8b315d2f5..50aac378e 100644 --- a/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json +++ b/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json @@ -236,6 +236,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:52:61:2b:43-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:52:61:2b:43:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:52:61:2b:43", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json b/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json index 231f16ccd..8ef6d212f 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json @@ -241,6 +241,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "14:b4:57:ff:fe:53:65:d7-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "14:b4:57:ff:fe:53:65:d7:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "14:b4:57:ff:fe:53:65:d7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json b/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json index b98e3bb6b..f2879c8ca 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json @@ -241,6 +241,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "90:fd:9f:ff:fe:fe:d8:a1-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "90:fd:9f:ff:fe:fe:d8:a1:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "90:fd:9f:ff:fe:fe:d8:a1", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json b/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json index c8516a151..2fc5adc06 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json @@ -248,6 +248,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0b:57:ff:fe:2b:cf:1f-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:0b:57:ff:fe:2b:cf:1f:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0b:57:ff:fe:2b:cf:1f", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/inovelli-vzm30-sn.json b/tests/data/devices/inovelli-vzm30-sn.json index ffc11c4b1..60bdb0e45 100644 --- a/tests/data/devices/inovelli-vzm30-sn.json +++ b/tests/data/devices/inovelli-vzm30-sn.json @@ -720,6 +720,90 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:9a:d6:cb:e7", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7-3-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 3, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "3:0x0008_client", + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7:3:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:9a:d6:cb:e7", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "light": [ { "info_object": { @@ -735,7 +819,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/inovelli-vzm31-sn.json b/tests/data/devices/inovelli-vzm31-sn.json index 75edb5b5d..ac93d1cb9 100644 --- a/tests/data/devices/inovelli-vzm31-sn.json +++ b/tests/data/devices/inovelli-vzm31-sn.json @@ -877,6 +877,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:dc:41:3c:40-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "ab:cd:ef:12:dc:41:3c:40:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:dc:41:3c:40", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "light": [ { "info_object": { @@ -892,7 +935,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/inovelli-vzm35-sn.json b/tests/data/devices/inovelli-vzm35-sn.json index 18fa6f0e4..52543adff 100644 --- a/tests/data/devices/inovelli-vzm35-sn.json +++ b/tests/data/devices/inovelli-vzm35-sn.json @@ -532,6 +532,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:03:3d:90:21-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "ab:cd:ef:12:03:3d:90:21:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:03:3d:90:21", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "light": [ { "info_object": { @@ -547,7 +590,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/jasco-products-45857.json b/tests/data/devices/jasco-products-45857.json index 8c958eaff..eb80bc83b 100644 --- a/tests/data/devices/jasco-products-45857.json +++ b/tests/data/devices/jasco-products-45857.json @@ -372,6 +372,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:22:a3:00:00:25:2c:24-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "00:22:a3:00:00:25:2c:24:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:22:a3:00:00:25:2c:24", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "light": [ { "info_object": { @@ -387,7 +430,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/lds-zbt-cctswitch-d0001.json b/tests/data/devices/lds-zbt-cctswitch-d0001.json index 27a91956b..1e109ef73 100644 --- a/tests/data/devices/lds-zbt-cctswitch-d0001.json +++ b/tests/data/devices/lds-zbt-cctswitch-d0001.json @@ -236,6 +236,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "14:b4:57:ff:fe:81:56:33-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "14:b4:57:ff:fe:81:56:33:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "14:b4:57:ff:fe:81:56:33", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/legrand-double-gangs-remote-switch.json b/tests/data/devices/legrand-double-gangs-remote-switch.json index 4729ceab5..0ada7df38 100644 --- a/tests/data/devices/legrand-double-gangs-remote-switch.json +++ b/tests/data/devices/legrand-double-gangs-remote-switch.json @@ -303,6 +303,90 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b6:14:95:c6-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:b6:14:95:c6:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b6:14:95:c6", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b6:14:95:c6-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "ab:cd:ef:12:b6:14:95:c6:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b6:14:95:c6", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lk-zbt-dimswitch-d0001.json b/tests/data/devices/lk-zbt-dimswitch-d0001.json index e2bcc2934..9b0bc38cf 100644 --- a/tests/data/devices/lk-zbt-dimswitch-d0001.json +++ b/tests/data/devices/lk-zbt-dimswitch-d0001.json @@ -206,6 +206,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "5c:02:72:ff:fe:3f:8c:a4-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "5c:02:72:ff:fe:3f:8c:a4:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "5c:02:72:ff:fe:3f:8c:a4", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lumi-lumi-remote-b286opcn01.json b/tests/data/devices/lumi-lumi-remote-b286opcn01.json index b47ff2a23..1b60f0eed 100644 --- a/tests/data/devices/lumi-lumi-remote-b286opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b286opcn01.json @@ -426,6 +426,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lumi-lumi-remote-b486opcn01.json b/tests/data/devices/lumi-lumi-remote-b486opcn01.json index 9d48aeca3..da692bac1 100755 --- a/tests/data/devices/lumi-lumi-remote-b486opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b486opcn01.json @@ -292,6 +292,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:7b-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "04:cf:8c:df:3c:75:c1:7b:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:7b", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lumi-lumi-remote-b686opcn01.json b/tests/data/devices/lumi-lumi-remote-b686opcn01.json index 35811c9f5..bd4cc421c 100644 --- a/tests/data/devices/lumi-lumi-remote-b686opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b686opcn01.json @@ -400,6 +400,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lumi-lumi-sensor-switch.json b/tests/data/devices/lumi-lumi-sensor-switch.json index 393e85ef4..dcc4f81b8 100644 --- a/tests/data/devices/lumi-lumi-sensor-switch.json +++ b/tests/data/devices/lumi-lumi-sensor-switch.json @@ -222,6 +222,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:10:ba:72-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:15:8d:00:02:10:ba:72:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:10:ba:72", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lutron-lzl4bwhl01-remote.json b/tests/data/devices/lutron-lzl4bwhl01-remote.json index 10954975c..45c434a22 100644 --- a/tests/data/devices/lutron-lzl4bwhl01-remote.json +++ b/tests/data/devices/lutron-lzl4bwhl01-remote.json @@ -160,6 +160,49 @@ } }, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ff:ff:00:0f:e7:ff:3c:b3-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ff:ff:00:0f:e7:ff:3c:b3:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ff:ff:00:0f:e7:ff:3c:b3", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/lutron-z3-1brl.json b/tests/data/devices/lutron-z3-1brl.json index dcdf3ec0f..1db2001d8 100644 --- a/tests/data/devices/lutron-z3-1brl.json +++ b/tests/data/devices/lutron-z3-1brl.json @@ -195,6 +195,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ff:ff:00:0f:e7:fb:f0:07-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ff:ff:00:0f:e7:fb:f0:07:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ff:ff:00:0f:e7:fb:f0:07", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/mli-zbt-remote-all-rgbw.json b/tests/data/devices/mli-zbt-remote-all-rgbw.json index 95042a55e..899d66e18 100644 --- a/tests/data/devices/mli-zbt-remote-all-rgbw.json +++ b/tests/data/devices/mli-zbt-remote-all-rgbw.json @@ -551,6 +551,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b1:2f:b5:32-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:b1:2f:b5:32:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b1:2f:b5:32", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json index dff0f1b9b..4c38aff52 100644 --- a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json +++ b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json @@ -158,6 +158,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:90:e3:16:0a-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:90:e3:16:0a:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:90:e3:16:0a", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/osram-switch-4x-lightify.json b/tests/data/devices/osram-switch-4x-lightify.json index baf790ac1..aff7d67fc 100644 --- a/tests/data/devices/osram-switch-4x-lightify.json +++ b/tests/data/devices/osram-switch-4x-lightify.json @@ -757,6 +757,254 @@ } }, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-2-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 2, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "2:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:2:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-3-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 3, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "3:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:3:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-4-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 4, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "4:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:4:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 4, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-5-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 5, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "5:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:5:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 5, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-6-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 6, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "6:0x0008_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:6:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 6, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/philips-rom001.json b/tests/data/devices/philips-rom001.json index a8f1ffd31..524cb575c 100644 --- a/tests/data/devices/philips-rom001.json +++ b/tests/data/devices/philips-rom001.json @@ -262,6 +262,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:06:54:a7:c3-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:17:88:01:06:54:a7:c3:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:06:54:a7:c3", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/philips-rwl020.json b/tests/data/devices/philips-rwl020.json index a8f1bfc02..2462797ff 100644 --- a/tests/data/devices/philips-rwl020.json +++ b/tests/data/devices/philips-rwl020.json @@ -325,6 +325,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:08:07:c3:5b-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:17:88:01:08:07:c3:5b:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:08:07:c3:5b", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/signify-netherlands-b-v-rdm001.json b/tests/data/devices/signify-netherlands-b-v-rdm001.json index 04ba86e42..c85ff8f14 100644 --- a/tests/data/devices/signify-netherlands-b-v-rdm001.json +++ b/tests/data/devices/signify-netherlands-b-v-rdm001.json @@ -224,6 +224,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0b:02:b6:79-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:17:88:01:0b:02:b6:79:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0b:02:b6:79", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/signify-netherlands-b-v-rdm002.json b/tests/data/devices/signify-netherlands-b-v-rdm002.json index 57b4e0d36..d6a402f58 100644 --- a/tests/data/devices/signify-netherlands-b-v-rdm002.json +++ b/tests/data/devices/signify-netherlands-b-v-rdm002.json @@ -240,6 +240,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0d:13:48:33-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:17:88:01:0d:13:48:33:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0d:13:48:33", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/signify-netherlands-b-v-rwl022.json b/tests/data/devices/signify-netherlands-b-v-rwl022.json index 9a7cf3923..6cd5c1cbf 100644 --- a/tests/data/devices/signify-netherlands-b-v-rwl022.json +++ b/tests/data/devices/signify-netherlands-b-v-rwl022.json @@ -236,6 +236,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0c:26:42:ec-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "00:17:88:01:0c:26:42:ec:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0c:26:42:ec", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/third-reality-inc-3rsb22bz.json b/tests/data/devices/third-reality-inc-3rsb22bz.json index 72800c0ac..99bd7d22a 100644 --- a/tests/data/devices/third-reality-inc-3rsb22bz.json +++ b/tests/data/devices/third-reality-inc-3rsb22bz.json @@ -140,6 +140,49 @@ } }, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "28:2c:02:bf:ff:e3:74:f8-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "28:2c:02:bf:ff:e3:74:f8:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "28:2c:02:bf:ff:e3:74:f8", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/tz3000-gwkzibhs-ts004f.json b/tests/data/devices/tz3000-gwkzibhs-ts004f.json index a775d28d0..e5fb8728e 100644 --- a/tests/data/devices/tz3000-gwkzibhs-ts004f.json +++ b/tests/data/devices/tz3000-gwkzibhs-ts004f.json @@ -297,6 +297,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:e5:79:a6:00-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:e5:79:a6:00:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:e5:79:a6:00", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/tz3000-kjfzuycl-ts004f.json b/tests/data/devices/tz3000-kjfzuycl-ts004f.json index 6a82f0d53..251ea4eb5 100644 --- a/tests/data/devices/tz3000-kjfzuycl-ts004f.json +++ b/tests/data/devices/tz3000-kjfzuycl-ts004f.json @@ -246,6 +246,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "38:5b:44:ff:fe:36:af:0f-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "38:5b:44:ff:fe:36:af:0f:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "38:5b:44:ff:fe:36:af:0f", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json index 61d6615cb..d10ac8ce4 100644 --- a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json +++ b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json @@ -215,6 +215,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:66:b9:e7:ff-1-8", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "LevelControlEvent", + "translation_key": "level_control", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "LevelControlClientClusterHandler", + "generic_id": "cluster_handler_0x0008_client", + "endpoint_id": 1, + "cluster": { + "id": 8, + "name": "Level control", + "type": "client" + }, + "id": "1:0x0008_client", + "unique_id": "ab:cd:ef:12:66:b9:e7:ff:1:0x0008_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:66:b9:e7:ff", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "LevelControlEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py new file mode 100644 index 000000000..4e29ee13b --- /dev/null +++ b/tests/test_platform_event.py @@ -0,0 +1,96 @@ +"""Test zha fan.""" + +# pylint: disable=redefined-outer-name + +import logging + +from zigpy.device import Device as ZigpyDevice +from zigpy.profiles import zha +from zigpy.zcl.clusters import general, hvac +import zigpy.zdo.types as zdo_t + +from tests.common import ( + SIG_EP_INPUT, + SIG_EP_OUTPUT, + SIG_EP_PROFILE, + SIG_EP_TYPE, + create_mock_zigpy_device, + get_entity, + join_zigpy_device, + make_zcl_header, +) +from zha.application import Platform +from zha.application.gateway import Gateway + +IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" +IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e8" + +_LOGGER = logging.getLogger(__name__) + + +def zigpy_device_mock(zha_gateway: Gateway) -> ZigpyDevice: + """Device tracker zigpy device.""" + endpoints = { + 1: { + SIG_EP_INPUT: [], + SIG_EP_OUTPUT: [general.LevelControl.cluster_id], + SIG_EP_TYPE: zha.DeviceType.LEVEL_CONTROL_SWITCH, + SIG_EP_PROFILE: zha.PROFILE_ID, + } + } + return create_mock_zigpy_device( + zha_gateway, + endpoints, + node_descriptor=zdo_t.NodeDescriptor( + logical_type=zdo_t.LogicalType.EndDevice, + complex_descriptor_available=0, + user_descriptor_available=0, + reserved=0, + aps_flags=0, + frequency_band=zdo_t.NodeDescriptor.FrequencyBand.Freq2400MHz, + mac_capability_flags=( + zdo_t.NodeDescriptor.MACCapabilityFlags.MainsPowered + | zdo_t.NodeDescriptor.MACCapabilityFlags.RxOnWhenIdle + | zdo_t.NodeDescriptor.MACCapabilityFlags.AllocateAddress + ), + manufacturer_code=4098, + maximum_buffer_size=82, + maximum_incoming_transfer_size=82, + server_mask=0, + maximum_outgoing_transfer_size=82, + descriptor_capability_field=zdo_t.NodeDescriptor.DescriptorCapability.NONE, + ), + ) + + +async def test_event( + zha_gateway: Gateway, +) -> None: + """Test zha fan platform.""" + + zigpy_device = zigpy_device_mock(zha_gateway) + zha_device = await join_zigpy_device(zha_gateway, zigpy_device) + cluster: general.LevelControl = zigpy_device.endpoints.get(1).out_clusters[ + general.LevelControl.cluster_id + ] + + entity = get_entity(zha_device, platform=Platform.EVENT) + assert entity + + hdr = make_zcl_header( + cluster.ServerCommandDefs.step.id, global_command=False, tsn=1 + ) + msg = cluster.ServerCommandDefs.step.schema( + step_mode=1, step_size=10, transition_time=5 + ) + cluster.handle_message(hdr, msg) + assert entity.state == { + "event_attributes": { + "step_mode": 1, + "step_size": 10, + "transition_time": 5, + }, + "event_type": "step", + "available": True, + "class_name": "LevelControlEvent", + } diff --git a/zha/application/discovery.py b/zha/application/discovery.py index bacae08d2..c8de8c222 100644 --- a/zha/application/discovery.py +++ b/zha/application/discovery.py @@ -34,6 +34,7 @@ climate, cover, device_tracker, + event, fan, light, lock, @@ -88,6 +89,7 @@ Platform.CLIMATE, Platform.COVER, Platform.DEVICE_TRACKER, + Platform.EVENT, Platform.FAN, Platform.LIGHT, Platform.LOCK, @@ -478,19 +480,19 @@ def discover_by_cluster_id(self, endpoint: Endpoint) -> Iterator[PlatformEntity] yield from self.probe_single_cluster(platform, cluster_handler, endpoint) - # until we can get rid of registries - yield from self.handle_on_off_output_cluster_exception(endpoint) + profile_id = endpoint.zigpy_endpoint.profile_id + device_type = endpoint.zigpy_endpoint.device_type + if device_type in REMOTE_DEVICE_TYPES.get(profile_id, []): + yield from self._handle_single_output_clusters(endpoint) + else: + # until we can get rid of registries + yield from self.handle_on_off_output_cluster_exception(endpoint) def handle_on_off_output_cluster_exception( self, endpoint: Endpoint ) -> Iterator[PlatformEntity]: """Process output clusters of the endpoint.""" - profile_id = endpoint.zigpy_endpoint.profile_id - device_type = endpoint.zigpy_endpoint.device_type - if device_type in REMOTE_DEVICE_TYPES.get(profile_id, []): - return - for cluster_id, cluster in endpoint.zigpy_endpoint.out_clusters.items(): platform = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get(cluster.cluster_id) if platform is None: @@ -517,6 +519,24 @@ def handle_on_off_output_cluster_exception( yield from self.probe_single_cluster(platform, cluster_handler, endpoint) + def _handle_single_output_clusters( + self, endpoint: Endpoint + ) -> Iterator[PlatformEntity]: + """Process output clusters of the endpoint.""" + remaining_cluster_handlers = endpoint.client_cluster_handlers.values() + for cluster_handler in remaining_cluster_handlers: + if cluster_handler.cluster.cluster_id in CLUSTER_HANDLER_ONLY_CLUSTERS: + endpoint.claim_cluster_handlers([cluster_handler]) + continue + + platform = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get( + cluster_handler.cluster.cluster_id + ) + if platform is None: + continue + + yield from self.probe_single_cluster(platform, cluster_handler, endpoint) + def discover_multi_entities( self, endpoint: Endpoint, diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py new file mode 100644 index 000000000..ff5ddf704 --- /dev/null +++ b/zha/application/platforms/event.py @@ -0,0 +1,119 @@ +"""Fans on Zigbee Home Automation networks.""" + +from __future__ import annotations + +import functools +from typing import TYPE_CHECKING, Any + +from zha.application import Platform +from zha.application.platforms import EntityStateChangedEvent, PlatformEntity +from zha.application.registries import PLATFORM_ENTITIES +from zha.const import STATE_CHANGED +from zha.zigbee.cluster_handlers.const import ( + CLIENT_CLUSTER_HANDLER_LEVEL, + CLUSTER_HANDLER_COMMAND_EVENT, +) + +if TYPE_CHECKING: + from zha.zigbee.cluster_handlers import ClusterHandler + from zha.zigbee.cluster_handlers.general import ClusterHandlerCommandEvent + from zha.zigbee.device import Device + from zha.zigbee.endpoint import Endpoint + +from enum import StrEnum + +STRICT_MATCH = functools.partial(PLATFORM_ENTITIES.strict_match, Platform.EVENT) +GROUP_MATCH = functools.partial(PLATFORM_ENTITIES.group_match, Platform.EVENT) +MULTI_MATCH = functools.partial(PLATFORM_ENTITIES.multipass_match, Platform.EVENT) + + +class EventDeviceClass(StrEnum): + """Device class for events.""" + + DOORBELL = "doorbell" + BUTTON = "button" + MOTION = "motion" + + +class BaseEvent(PlatformEntity): + """Base representation of a ZHA fan.""" + + PLATFORM = Platform.EVENT + + _attr_translation_key: str = "event" + _attr_event_types: list[str] = [] + _attr_device_class: EventDeviceClass | None = None + _attr_primary_weight = 10 + _state: dict[str, Any] = {} + _cluster_handler_name: str + _cluster_handler: ClusterHandler + + def __init__( + self, + cluster_handlers: list[ClusterHandler], + endpoint: Endpoint, + device: Device, + **kwargs, + ) -> None: + """Initialize the fan.""" + super().__init__(cluster_handlers, endpoint, device, **kwargs) + self._cluster_handler = self.cluster_handlers[self._cluster_handler_name] + + @property + def state(self) -> dict[str, Any]: + """Return the state of the select.""" + response = super().state + response.update(self._state) + return response + + @functools.cached_property + def device_class(self) -> EventDeviceClass | None: + """Return the class of this entity.""" + return self._attr_device_class + + @functools.cached_property + def event_types(self) -> list[str]: + """Return a list of possible events.""" + return self._attr_event_types + + def on_add(self) -> None: + """Run when entity is added.""" + super().on_add() + self._on_remove_callbacks.append( + self._cluster_handler.on_event( + CLUSTER_HANDLER_COMMAND_EVENT, + self.handle_cluster_handler_command, + ) + ) + + def handle_cluster_handler_command( + self, + event: ClusterHandlerCommandEvent, + ) -> None: + """Handle state update from cluster handler.""" + if event.event not in self._attr_event_types: + self.debug("Event type %s ignored", event.event) + return + + self._state = { + "event_attributes": event.data, + "event_type": event.event, + } + self.emit(STATE_CHANGED, EntityStateChangedEvent(**self.identifiers.__dict__)) + + +@STRICT_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_LEVEL) +class LevelControlEvent(BaseEvent, PlatformEntity): + """Representation of a ZHA fan.""" + + _attr_translation_key = "level_control" + _attr_event_types = [ + "step", + "step_with_on_off", + "stop", + "move", + "move_with_on_off", + "move_to_level", + "move_to_level_with_on_off", + ] + _cluster_handler_name = CLIENT_CLUSTER_HANDLER_LEVEL diff --git a/zha/application/registries.py b/zha/application/registries.py index 404afa97f..c8764f864 100644 --- a/zha/application/registries.py +++ b/zha/application/registries.py @@ -59,6 +59,7 @@ } SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = { + zcl.clusters.general.LevelControl.cluster_id: Platform.EVENT, zcl.clusters.general.OnOff.cluster_id: Platform.BINARY_SENSOR, zcl.clusters.security.IasAce.cluster_id: Platform.ALARM_CONTROL_PANEL, } diff --git a/zha/zigbee/cluster_handlers/const.py b/zha/zigbee/cluster_handlers/const.py index 0f5b1c3d1..b339dd159 100644 --- a/zha/zigbee/cluster_handlers/const.py +++ b/zha/zigbee/cluster_handlers/const.py @@ -80,7 +80,9 @@ ZONE: Final[str] = CLUSTER_HANDLER_ZONE CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster" +CLIENT_CLUSTER_HANDLER_LEVEL: Final[str] = CLUSTER_HANDLER_LEVEL + "_client" CLIENT_CLUSTER_HANDLER_OTA: Final[str] = CLUSTER_HANDLER_OTA + "_client" + AQARA_OPPLE_CLUSTER: Final[int] = 0xFCC0 IKEA_AIR_PURIFIER_CLUSTER: Final[int] = 0xFC7D IKEA_REMOTE_CLUSTER: Final[int] = 0xFC80 @@ -101,6 +103,7 @@ CLUSTER_HANDLER_ATTRIBUTE_UPDATED: Final[str] = "cluster_handler_attribute_updated" CLUSTER_HANDLER_STATE_CHANGED: Final[str] = "cluster_handler_state_changed" CLUSTER_HANDLER_LEVEL_CHANGED: Final[str] = "cluster_handler_level_changed" +CLUSTER_HANDLER_COMMAND_EVENT: Final[str] = "cluster_handler_command_event" ATTRIBUTE_ID: Final[str] = "attribute_id" ATTRIBUTE_NAME: Final[str] = "attribute_name" diff --git a/zha/zigbee/cluster_handlers/general.py b/zha/zigbee/cluster_handlers/general.py index e47517495..0def5dc98 100644 --- a/zha/zigbee/cluster_handlers/general.py +++ b/zha/zigbee/cluster_handlers/general.py @@ -42,7 +42,7 @@ Time, ) from zigpy.zcl.clusters.general_const import ApplicationType -from zigpy.zcl.foundation import Status +from zigpy.zcl.foundation import CommandSchema, Status from zha.exceptions import ZHAException from zha.zigbee.cluster_handlers import ( @@ -53,6 +53,7 @@ registries, ) from zha.zigbee.cluster_handlers.const import ( + CLUSTER_HANDLER_COMMAND_EVENT, CLUSTER_HANDLER_LEVEL_CHANGED, REPORT_CONFIG_ASAP, REPORT_CONFIG_BATTERY_SAVE, @@ -78,6 +79,15 @@ class LevelChangeEvent: event_type: Final[str] = "cluster_handler_event" +@dataclass(frozen=True, kw_only=True) +class ClusterHandlerCommandEvent: + """Event to signal that a cluster command was received.""" + + event: str + event_type: Final[str] = "cluster_handler_event" + data: dict[str, Any] + + @registries.CLUSTER_HANDLER_REGISTRY.register(Alarms.cluster_id) class AlarmsClusterHandler(ClusterHandler): """Alarms cluster handler.""" @@ -412,6 +422,25 @@ def cluster_command(self, tsn, command_id, args): class LevelControlClientClusterHandler(ClientClusterHandler): """LevelControl client cluster.""" + def cluster_command(self, tsn: int, command_id: int, args: CommandSchema): + """Handle commands received to this cluster.""" + + parse_and_log_command(self, tsn, command_id, args) + + if (command := self._cluster.server_commands.get(command_id)) is None: + return + + # Emit standard zha event + self.emit_zha_event(command.name, args) + + # Emit internal parsed event + self.emit( + CLUSTER_HANDLER_COMMAND_EVENT, + ClusterHandlerCommandEvent( + event=command.name, data=args.as_dict(skip_missing=True, recursive=True) + ), + ) + @registries.BINDABLE_CLUSTERS.register(LevelControl.cluster_id) @registries.CLUSTER_HANDLER_REGISTRY.register(LevelControl.cluster_id) From 79d847ce3f9f9f87436dae078ffcd7b02a9498c8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:10:43 +0000 Subject: [PATCH 03/11] Apply pre-commit auto fixes --- tests/test_platform_event.py | 2 +- zha/application/platforms/update.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index 4e29ee13b..5347f9fcb 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -6,7 +6,7 @@ from zigpy.device import Device as ZigpyDevice from zigpy.profiles import zha -from zigpy.zcl.clusters import general, hvac +from zigpy.zcl.clusters import general import zigpy.zdo.types as zdo_t from tests.common import ( diff --git a/zha/application/platforms/update.py b/zha/application/platforms/update.py index 7da9e7f5d..31bc155c1 100644 --- a/zha/application/platforms/update.py +++ b/zha/application/platforms/update.py @@ -19,9 +19,9 @@ from zha.exceptions import ZHAException from zha.zigbee.cluster_handlers import ClusterAttributeUpdatedEvent from zha.zigbee.cluster_handlers.const import ( + CLIENT_CLUSTER_HANDLER_OTA, CLUSTER_HANDLER_ATTRIBUTE_UPDATED, CLUSTER_HANDLER_OTA, - CLIENT_CLUSTER_HANDLER_OTA, ) from zha.zigbee.endpoint import Endpoint From f9610c321907ba31263621945cc188d742075c9a Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 3 Dec 2025 16:23:38 +0100 Subject: [PATCH 04/11] Avoid putting cluster handler info in base event --- zha/application/platforms/event.py | 77 +++++++++++++++++------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index ff5ddf704..86de38713 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -6,7 +6,11 @@ from typing import TYPE_CHECKING, Any from zha.application import Platform -from zha.application.platforms import EntityStateChangedEvent, PlatformEntity +from zha.application.platforms import ( + EntityStateChangedEvent, + PlatformEntity, + BaseEntity, +) from zha.application.registries import PLATFORM_ENTITIES from zha.const import STATE_CHANGED from zha.zigbee.cluster_handlers.const import ( @@ -35,8 +39,8 @@ class EventDeviceClass(StrEnum): MOTION = "motion" -class BaseEvent(PlatformEntity): - """Base representation of a ZHA fan.""" +class BaseEvent(BaseEntity): + """Base representation of a ZHA events.""" PLATFORM = Platform.EVENT @@ -45,26 +49,6 @@ class BaseEvent(PlatformEntity): _attr_device_class: EventDeviceClass | None = None _attr_primary_weight = 10 _state: dict[str, Any] = {} - _cluster_handler_name: str - _cluster_handler: ClusterHandler - - def __init__( - self, - cluster_handlers: list[ClusterHandler], - endpoint: Endpoint, - device: Device, - **kwargs, - ) -> None: - """Initialize the fan.""" - super().__init__(cluster_handlers, endpoint, device, **kwargs) - self._cluster_handler = self.cluster_handlers[self._cluster_handler_name] - - @property - def state(self) -> dict[str, Any]: - """Return the state of the select.""" - response = super().state - response.update(self._state) - return response @functools.cached_property def device_class(self) -> EventDeviceClass | None: @@ -76,6 +60,41 @@ def event_types(self) -> list[str]: """Return a list of possible events.""" return self._attr_event_types + @property + def state(self) -> dict[str, Any]: + """Return the state of the select.""" + response = super().state + response.update(self._state) + return response + + def _trigger_event(self, event_type: str, event_attributes: dict[str, Any]) -> None: + """Handle state update from cluster handler.""" + if event_type not in self._attr_event_types: + self.debug("Event type %s ignored", event_type) + return + + self._state = { + "event_attributes": event_attributes, + "event_type": event_type, + } + self.emit(STATE_CHANGED, EntityStateChangedEvent(**self.identifiers.__dict__)) + + +class ClusterHandlerEvent(BaseEvent, PlatformEntity): + """Base representation of a ZHA events using cluster handler.""" + + _cluster_handler_name: str + _cluster_handler: ClusterHandler + + def __init__( + self, + *args, + **kwargs, + ) -> None: + """Initialize the fan.""" + super().__init__(*args, **kwargs) + self._cluster_handler = self.cluster_handlers[self._cluster_handler_name] + def on_add(self) -> None: """Run when entity is added.""" super().on_add() @@ -91,19 +110,11 @@ def handle_cluster_handler_command( event: ClusterHandlerCommandEvent, ) -> None: """Handle state update from cluster handler.""" - if event.event not in self._attr_event_types: - self.debug("Event type %s ignored", event.event) - return - - self._state = { - "event_attributes": event.data, - "event_type": event.event, - } - self.emit(STATE_CHANGED, EntityStateChangedEvent(**self.identifiers.__dict__)) + self._trigger_event(event.event, event.data) @STRICT_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_LEVEL) -class LevelControlEvent(BaseEvent, PlatformEntity): +class LevelControlEvent(ClusterHandlerEvent): """Representation of a ZHA fan.""" _attr_translation_key = "level_control" From e50b448d91c940f36b38a139736888aeeba3e7df Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:24:41 +0000 Subject: [PATCH 05/11] Apply pre-commit auto fixes --- zha/application/platforms/event.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index 86de38713..fe51ce765 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -7,9 +7,9 @@ from zha.application import Platform from zha.application.platforms import ( + BaseEntity, EntityStateChangedEvent, PlatformEntity, - BaseEntity, ) from zha.application.registries import PLATFORM_ENTITIES from zha.const import STATE_CHANGED @@ -21,8 +21,6 @@ if TYPE_CHECKING: from zha.zigbee.cluster_handlers import ClusterHandler from zha.zigbee.cluster_handlers.general import ClusterHandlerCommandEvent - from zha.zigbee.device import Device - from zha.zigbee.endpoint import Endpoint from enum import StrEnum From 05f94d473fa11c44f4652e230811e0d42000ddc8 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 3 Dec 2025 16:43:13 +0100 Subject: [PATCH 06/11] Add some tests --- tests/test_platform_event.py | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index 5347f9fcb..df8fafbe8 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -4,6 +4,7 @@ import logging +import pytest from zigpy.device import Device as ZigpyDevice from zigpy.profiles import zha from zigpy.zcl.clusters import general @@ -21,6 +22,7 @@ ) from zha.application import Platform from zha.application.gateway import Gateway +from zha.application.platforms.event import BaseEvent IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e8" @@ -75,14 +77,20 @@ async def test_event( ] entity = get_entity(zha_device, platform=Platform.EVENT) - assert entity + assert isinstance(entity, BaseEvent) + assert entity.event_types == [ + "step", + "step_with_on_off", + "stop", + "move", + "move_with_on_off", + "move_to_level", + "move_to_level_with_on_off", + ] - hdr = make_zcl_header( - cluster.ServerCommandDefs.step.id, global_command=False, tsn=1 - ) - msg = cluster.ServerCommandDefs.step.schema( - step_mode=1, step_size=10, transition_time=5 - ) + cmd = cluster.ServerCommandDefs.step + hdr = make_zcl_header(cmd.id, global_command=False, tsn=1) + msg = cmd.schema(step_mode=1, step_size=10, transition_time=5) cluster.handle_message(hdr, msg) assert entity.state == { "event_attributes": { @@ -94,3 +102,30 @@ async def test_event( "available": True, "class_name": "LevelControlEvent", } + + +async def test_invalid_event( + zha_gateway: Gateway, + caplog: pytest.LogCaptureFixture, +) -> None: + """Test that an invalid command does not trigger an exception.""" + + zigpy_device = zigpy_device_mock(zha_gateway) + zha_device = await join_zigpy_device(zha_gateway, zigpy_device) + cluster: general.LevelControl = zigpy_device.endpoints.get(1).out_clusters[ + general.LevelControl.cluster_id + ] + + entity = get_entity(zha_device, platform=Platform.EVENT) + assert isinstance(entity, BaseEvent) + + # cmd = general.OnOff.ServerCommandDefs.on + hdr = make_zcl_header(0xFF, global_command=False, tsn=1) + msg = b"" + + caplog.clear() + cluster.handle_message(hdr, msg) + assert ( + "[0xB79C:1:0x0008_client]: received '0xFF' command with b'' args on cluster_id '8' tsn '1'\n" + in caplog.text + ) From 4605fb6aadcae89161e685ba0409417e0453ff63 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Fri, 5 Dec 2025 21:33:16 +0100 Subject: [PATCH 07/11] Add On/Off platform event --- tests/data/devices/awox-tlsr82xx.json | 43 ++- tests/data/devices/ewelink-snzb-01p.json | 43 +++ tests/data/devices/ewelink-wb01.json | 43 +++ tests/data/devices/hobeian-zg-101zl.json | 41 +++ ...of-sweden-parasoll-door-window-sensor.json | 45 +++- .../ikea-of-sweden-remote-control-n2.json | 43 ++- .../devices/ikea-of-sweden-rodret-dimmer.json | 43 ++- ...ikea-of-sweden-rodret-wireless-dimmer.json | 43 ++- ...ikea-of-sweden-somrig-shortcut-button.json | 82 ++++++ ...of-sweden-symfonisk-sound-remote-gen2.json | 43 ++- .../ikea-of-sweden-tradfri-on-off-switch.json | 43 ++- ...ikea-of-sweden-tradfri-remote-control.json | 43 ++- ...kea-of-sweden-tradfri-wireless-dimmer.json | 43 ++- tests/data/devices/inovelli-vzm30-sn.json | 82 ++++++ tests/data/devices/inovelli-vzm31-sn.json | 41 +++ tests/data/devices/inovelli-vzm35-sn.json | 41 +++ tests/data/devices/jasco-products-45856.json | 45 +++- tests/data/devices/jasco-products-45857.json | 41 +++ .../data/devices/lds-zbt-cctswitch-d0001.json | 43 ++- .../legrand-double-gangs-remote-switch.json | 82 ++++++ .../data/devices/lk-zbt-dimswitch-d0001.json | 43 ++- .../devices/lumi-lumi-remote-b286opcn01.json | 248 +++++++++++++++++- .../devices/lumi-lumi-remote-b486opcn01.json | 84 +++++- .../devices/lumi-lumi-remote-b686opcn01.json | 248 +++++++++++++++++- .../data/devices/lumi-lumi-sensor-86sw2.json | 127 ++++++++- .../devices/lumi-lumi-sensor-switch-aq2.json | 45 +++- .../devices/lumi-lumi-sensor-switch-aq3.json | 45 +++- .../data/devices/lumi-lumi-sensor-switch.json | 43 ++- .../devices/lutron-lzl4bwhl01-remote.json | 43 ++- tests/data/devices/lutron-z3-1brl.json | 43 ++- .../data/devices/mli-zbt-remote-all-rgbw.json | 43 ++- .../neuhaus-lighting-group-nlg-remote.json | 43 ++- .../devices/osram-switch-4x-lightify.json | 246 +++++++++++++++++ tests/data/devices/philips-rom001.json | 43 ++- tests/data/devices/philips-rwl020.json | 43 ++- .../data/devices/securifi-ltd-unk-model.json | 45 +++- .../signify-netherlands-b-v-rdm001.json | 43 ++- .../signify-netherlands-b-v-rdm002.json | 43 ++- .../signify-netherlands-b-v-rwl022.json | 43 ++- .../devices/third-reality-inc-3rsb22bz.json | 43 ++- .../devices/third-reality-inc-3rss009z.json | 45 +++- .../data/devices/tz3000-xa9g7rxs-ts1002.json | 43 ++- tests/test_platform_event.py | 50 +++- zha/application/discovery.py | 16 +- zha/application/platforms/event.py | 20 +- zha/application/registries.py | 6 +- zha/zigbee/cluster_handlers/__init__.py | 35 ++- zha/zigbee/cluster_handlers/const.py | 1 + zha/zigbee/cluster_handlers/general.py | 28 -- 49 files changed, 2741 insertions(+), 80 deletions(-) diff --git a/tests/data/devices/awox-tlsr82xx.json b/tests/data/devices/awox-tlsr82xx.json index 9e36e61e3..1237e7789 100644 --- a/tests/data/devices/awox-tlsr82xx.json +++ b/tests/data/devices/awox-tlsr82xx.json @@ -200,6 +200,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "a4:c1:38:01:9c:d6:df:d1-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "a4:c1:38:01:9c:d6:df:d1:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "a4:c1:38:01:9c:d6:df:d1", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -214,7 +255,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ewelink-snzb-01p.json b/tests/data/devices/ewelink-snzb-01p.json index 7b1d2b021..583564c3e 100644 --- a/tests/data/devices/ewelink-snzb-01p.json +++ b/tests/data/devices/ewelink-snzb-01p.json @@ -188,6 +188,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "84:ba:20:ff:fe:d2:41:fe-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "84:ba:20:ff:fe:d2:41:fe:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "84:ba:20:ff:fe:d2:41:fe", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ewelink-wb01.json b/tests/data/devices/ewelink-wb01.json index b0fdc92aa..dc4660e9f 100644 --- a/tests/data/devices/ewelink-wb01.json +++ b/tests/data/devices/ewelink-wb01.json @@ -159,6 +159,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:12:4b:00:25:12:e0:f9-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:12:4b:00:25:12:e0:f9:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:12:4b:00:25:12:e0:f9", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/hobeian-zg-101zl.json b/tests/data/devices/hobeian-zg-101zl.json index de900222c..e0c5631ca 100644 --- a/tests/data/devices/hobeian-zg-101zl.json +++ b/tests/data/devices/hobeian-zg-101zl.json @@ -391,6 +391,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:41:15:95:9c-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:41:15:95:9c:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:41:15:95:9c", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/ikea-of-sweden-parasoll-door-window-sensor.json b/tests/data/devices/ikea-of-sweden-parasoll-door-window-sensor.json index 2fbd108f9..7af15b81c 100644 --- a/tests/data/devices/ikea-of-sweden-parasoll-door-window-sensor.json +++ b/tests/data/devices/ikea-of-sweden-parasoll-door-window-sensor.json @@ -235,7 +235,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "IASZoneClusterHandler", @@ -313,6 +313,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:87:27:ff:fe:4a:b3:25-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "04:87:27:ff:fe:4a:b3:25:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:87:27:ff:fe:4a:b3:25", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { diff --git a/tests/data/devices/ikea-of-sweden-remote-control-n2.json b/tests/data/devices/ikea-of-sweden-remote-control-n2.json index a2d66b903..d789cfac8 100644 --- a/tests/data/devices/ikea-of-sweden-remote-control-n2.json +++ b/tests/data/devices/ikea-of-sweden-remote-control-n2.json @@ -195,6 +195,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6b:e7:d0:70-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:6b:e7:d0:70:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6b:e7:d0:70", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -209,7 +250,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-rodret-dimmer.json b/tests/data/devices/ikea-of-sweden-rodret-dimmer.json index 1823904e0..f622d29d1 100644 --- a/tests/data/devices/ikea-of-sweden-rodret-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-rodret-dimmer.json @@ -244,6 +244,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "5c:c7:c1:ff:fe:cc:19:d9-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "5c:c7:c1:ff:fe:cc:19:d9:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "5c:c7:c1:ff:fe:cc:19:d9", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -258,7 +299,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json b/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json index 9f6cbd8dd..33aff2ae8 100644 --- a/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-rodret-wireless-dimmer.json @@ -261,6 +261,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:07:f8:aa:b7-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:07:f8:aa:b7:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:07:f8:aa:b7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -275,7 +316,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json b/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json index 87625f569..7a91668ba 100644 --- a/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json +++ b/tests/data/devices/ikea-of-sweden-somrig-shortcut-button.json @@ -322,6 +322,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6d:e6:02:47-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:6d:e6:02:47:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6d:e6:02:47", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -363,6 +404,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:6d:e6:02:47-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "ab:cd:ef:12:6d:e6:02:47:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:6d:e6:02:47", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json b/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json index 50aac378e..b4597f2f5 100644 --- a/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json +++ b/tests/data/devices/ikea-of-sweden-symfonisk-sound-remote-gen2.json @@ -237,6 +237,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:52:61:2b:43-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:52:61:2b:43:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:52:61:2b:43", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -251,7 +292,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json b/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json index 8ef6d212f..f8660549e 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-on-off-switch.json @@ -242,6 +242,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "14:b4:57:ff:fe:53:65:d7-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "14:b4:57:ff:fe:53:65:d7:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "14:b4:57:ff:fe:53:65:d7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -256,7 +297,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json b/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json index f2879c8ca..8e25890b4 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-remote-control.json @@ -242,6 +242,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "90:fd:9f:ff:fe:fe:d8:a1-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "90:fd:9f:ff:fe:fe:d8:a1:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "90:fd:9f:ff:fe:fe:d8:a1", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -256,7 +297,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json b/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json index 2fc5adc06..6a4986f86 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-wireless-dimmer.json @@ -249,6 +249,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0b:57:ff:fe:2b:cf:1f-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:0b:57:ff:fe:2b:cf:1f:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0b:57:ff:fe:2b:cf:1f", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -263,7 +304,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/inovelli-vzm30-sn.json b/tests/data/devices/inovelli-vzm30-sn.json index 60bdb0e45..83d2babb7 100644 --- a/tests/data/devices/inovelli-vzm30-sn.json +++ b/tests/data/devices/inovelli-vzm30-sn.json @@ -721,6 +721,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:9a:d6:cb:e7", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -762,6 +803,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7-3-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 3, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "3:0x0006_client", + "unique_id": "ab:cd:ef:12:9a:d6:cb:e7:3:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:9a:d6:cb:e7", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/inovelli-vzm31-sn.json b/tests/data/devices/inovelli-vzm31-sn.json index ac93d1cb9..89f639c36 100644 --- a/tests/data/devices/inovelli-vzm31-sn.json +++ b/tests/data/devices/inovelli-vzm31-sn.json @@ -878,6 +878,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:dc:41:3c:40-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "ab:cd:ef:12:dc:41:3c:40:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:dc:41:3c:40", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/inovelli-vzm35-sn.json b/tests/data/devices/inovelli-vzm35-sn.json index 52543adff..f642c3a2d 100644 --- a/tests/data/devices/inovelli-vzm35-sn.json +++ b/tests/data/devices/inovelli-vzm35-sn.json @@ -533,6 +533,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:03:3d:90:21-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "ab:cd:ef:12:03:3d:90:21:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:03:3d:90:21", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/jasco-products-45856.json b/tests/data/devices/jasco-products-45856.json index 6e1a7d62d..a695848e9 100644 --- a/tests/data/devices/jasco-products-45856.json +++ b/tests/data/devices/jasco-products-45856.json @@ -319,6 +319,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:22:a3:00:00:26:d3:61-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "00:22:a3:00:00:26:d3:61:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:22:a3:00:00:26:d3:61", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "light": [ { "info_object": { @@ -334,7 +377,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/jasco-products-45857.json b/tests/data/devices/jasco-products-45857.json index eb80bc83b..4054578fa 100644 --- a/tests/data/devices/jasco-products-45857.json +++ b/tests/data/devices/jasco-products-45857.json @@ -373,6 +373,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:22:a3:00:00:25:2c:24-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "00:22:a3:00:00:25:2c:24:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:22:a3:00:00:25:2c:24", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lds-zbt-cctswitch-d0001.json b/tests/data/devices/lds-zbt-cctswitch-d0001.json index 1e109ef73..aa27457e4 100644 --- a/tests/data/devices/lds-zbt-cctswitch-d0001.json +++ b/tests/data/devices/lds-zbt-cctswitch-d0001.json @@ -237,6 +237,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "14:b4:57:ff:fe:81:56:33-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "14:b4:57:ff:fe:81:56:33:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "14:b4:57:ff:fe:81:56:33", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -251,7 +292,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/legrand-double-gangs-remote-switch.json b/tests/data/devices/legrand-double-gangs-remote-switch.json index 0ada7df38..dcafbde89 100644 --- a/tests/data/devices/legrand-double-gangs-remote-switch.json +++ b/tests/data/devices/legrand-double-gangs-remote-switch.json @@ -304,6 +304,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b6:14:95:c6-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:b6:14:95:c6:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b6:14:95:c6", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -345,6 +386,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b6:14:95:c6-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "ab:cd:ef:12:b6:14:95:c6:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b6:14:95:c6", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lk-zbt-dimswitch-d0001.json b/tests/data/devices/lk-zbt-dimswitch-d0001.json index 9b0bc38cf..495cfea67 100644 --- a/tests/data/devices/lk-zbt-dimswitch-d0001.json +++ b/tests/data/devices/lk-zbt-dimswitch-d0001.json @@ -207,6 +207,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "5c:02:72:ff:fe:3f:8c:a4-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "5c:02:72:ff:fe:3f:8c:a4:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "5c:02:72:ff:fe:3f:8c:a4", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -221,7 +262,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/lumi-lumi-remote-b286opcn01.json b/tests/data/devices/lumi-lumi-remote-b286opcn01.json index 1b60f0eed..ce38959e0 100644 --- a/tests/data/devices/lumi-lumi-remote-b286opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b286opcn01.json @@ -427,6 +427,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -441,7 +482,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", @@ -467,6 +508,211 @@ "class_name": "LevelControlEvent", "available": true } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-3-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 3, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "3:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:3:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-4-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 4, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "4:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:4:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 4, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-5-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 5, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "5:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:5:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 5, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-6-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 6, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "6:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:6:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 6, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } } ], "sensor": [ diff --git a/tests/data/devices/lumi-lumi-remote-b486opcn01.json b/tests/data/devices/lumi-lumi-remote-b486opcn01.json index da692bac1..81ce2cb04 100755 --- a/tests/data/devices/lumi-lumi-remote-b486opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b486opcn01.json @@ -293,6 +293,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:7b-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:7b:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:7b", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -307,7 +348,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", @@ -333,6 +374,47 @@ "class_name": "LevelControlEvent", "available": true } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:7b-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "04:cf:8c:df:3c:75:c1:7b:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:7b", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } } ], "sensor": [ diff --git a/tests/data/devices/lumi-lumi-remote-b686opcn01.json b/tests/data/devices/lumi-lumi-remote-b686opcn01.json index bd4cc421c..7fa26850a 100644 --- a/tests/data/devices/lumi-lumi-remote-b686opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b686opcn01.json @@ -401,6 +401,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -415,7 +456,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", @@ -441,6 +482,211 @@ "class_name": "LevelControlEvent", "available": true } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-3-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 3, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "3:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:3:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-4-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 4, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "4:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:4:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 4, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-5-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 5, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "5:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:5:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 5, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-6-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 6, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "6:0x0006_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:6:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 6, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } } ], "sensor": [ diff --git a/tests/data/devices/lumi-lumi-sensor-86sw2.json b/tests/data/devices/lumi-lumi-sensor-86sw2.json index 7710441b2..a2d7e4fd6 100644 --- a/tests/data/devices/lumi-lumi-sensor-86sw2.json +++ b/tests/data/devices/lumi-lumi-sensor-86sw2.json @@ -384,6 +384,131 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:54:cb:fa-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:15:8d:00:02:54:cb:fa:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:54:cb:fa", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:54:cb:fa-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "00:15:8d:00:02:54:cb:fa:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:54:cb:fa", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:54:cb:fa-3-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 3, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "3:0x0006_client", + "unique_id": "00:15:8d:00:02:54:cb:fa:3:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:54:cb:fa", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { @@ -539,7 +664,7 @@ "entity_category": "diagnostic", "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "DeviceTemperatureClusterHandler", diff --git a/tests/data/devices/lumi-lumi-sensor-switch-aq2.json b/tests/data/devices/lumi-lumi-sensor-switch-aq2.json index 6def341c2..db1480a7a 100644 --- a/tests/data/devices/lumi-lumi-sensor-switch-aq2.json +++ b/tests/data/devices/lumi-lumi-sensor-switch-aq2.json @@ -184,6 +184,49 @@ } }, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:13:91:38-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:15:8d:00:02:13:91:38:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:13:91:38", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { @@ -339,7 +382,7 @@ "entity_category": "diagnostic", "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "DeviceTemperatureClusterHandler", diff --git a/tests/data/devices/lumi-lumi-sensor-switch-aq3.json b/tests/data/devices/lumi-lumi-sensor-switch-aq3.json index d2e0836e8..983c9af2d 100644 --- a/tests/data/devices/lumi-lumi-sensor-switch-aq3.json +++ b/tests/data/devices/lumi-lumi-sensor-switch-aq3.json @@ -156,6 +156,49 @@ } }, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:b0:e5:91-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": true, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:15:8d:00:02:b0:e5:91:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:b0:e5:91", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { @@ -311,7 +354,7 @@ "entity_category": "diagnostic", "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "DeviceTemperatureClusterHandler", diff --git a/tests/data/devices/lumi-lumi-sensor-switch.json b/tests/data/devices/lumi-lumi-sensor-switch.json index dcc4f81b8..d42fb53ee 100644 --- a/tests/data/devices/lumi-lumi-sensor-switch.json +++ b/tests/data/devices/lumi-lumi-sensor-switch.json @@ -223,6 +223,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:15:8d:00:02:10:ba:72-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:15:8d:00:02:10:ba:72:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:15:8d:00:02:10:ba:72", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -237,7 +278,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/lutron-lzl4bwhl01-remote.json b/tests/data/devices/lutron-lzl4bwhl01-remote.json index 45c434a22..62f656889 100644 --- a/tests/data/devices/lutron-lzl4bwhl01-remote.json +++ b/tests/data/devices/lutron-lzl4bwhl01-remote.json @@ -161,6 +161,47 @@ }, "zha_lib_entities": { "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ff:ff:00:0f:e7:ff:3c:b3-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ff:ff:00:0f:e7:ff:3c:b3:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ff:ff:00:0f:e7:ff:3c:b3", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -175,7 +216,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/lutron-z3-1brl.json b/tests/data/devices/lutron-z3-1brl.json index 1db2001d8..5a8c32f4b 100644 --- a/tests/data/devices/lutron-z3-1brl.json +++ b/tests/data/devices/lutron-z3-1brl.json @@ -196,6 +196,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ff:ff:00:0f:e7:fb:f0:07-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ff:ff:00:0f:e7:fb:f0:07:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ff:ff:00:0f:e7:fb:f0:07", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -210,7 +251,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/mli-zbt-remote-all-rgbw.json b/tests/data/devices/mli-zbt-remote-all-rgbw.json index 899d66e18..e932cc4e0 100644 --- a/tests/data/devices/mli-zbt-remote-all-rgbw.json +++ b/tests/data/devices/mli-zbt-remote-all-rgbw.json @@ -552,6 +552,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b1:2f:b5:32-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:b1:2f:b5:32:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b1:2f:b5:32", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -566,7 +607,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json index 4c38aff52..e040dab0c 100644 --- a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json +++ b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json @@ -159,6 +159,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:90:e3:16:0a-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:90:e3:16:0a:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:90:e3:16:0a", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -173,7 +214,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/osram-switch-4x-lightify.json b/tests/data/devices/osram-switch-4x-lightify.json index aff7d67fc..6303e8af7 100644 --- a/tests/data/devices/osram-switch-4x-lightify.json +++ b/tests/data/devices/osram-switch-4x-lightify.json @@ -758,6 +758,47 @@ }, "zha_lib_entities": { "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -799,6 +840,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-2-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 2, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "2:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:2:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -840,6 +922,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-3-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 3, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "3:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:3:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -881,6 +1004,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-4-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 4, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "4:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:4:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 4, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -922,6 +1086,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-5-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 5, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "5:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:5:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 5, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -963,6 +1168,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-6-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 6, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "6:0x0006_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:6:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 6, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/philips-rom001.json b/tests/data/devices/philips-rom001.json index 524cb575c..c1f6fc9d1 100644 --- a/tests/data/devices/philips-rom001.json +++ b/tests/data/devices/philips-rom001.json @@ -263,6 +263,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:06:54:a7:c3-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:17:88:01:06:54:a7:c3:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:06:54:a7:c3", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -277,7 +318,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/philips-rwl020.json b/tests/data/devices/philips-rwl020.json index 2462797ff..64d1326bc 100644 --- a/tests/data/devices/philips-rwl020.json +++ b/tests/data/devices/philips-rwl020.json @@ -326,6 +326,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:08:07:c3:5b-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:17:88:01:08:07:c3:5b:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:08:07:c3:5b", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -340,7 +381,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/securifi-ltd-unk-model.json b/tests/data/devices/securifi-ltd-unk-model.json index a0377c55f..3ed27270f 100644 --- a/tests/data/devices/securifi-ltd-unk-model.json +++ b/tests/data/devices/securifi-ltd-unk-model.json @@ -358,6 +358,49 @@ } } ], + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:05:49:ac:68-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:0d:6f:00:05:49:ac:68:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:05:49:ac:68", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "sensor": [ { "info_object": { @@ -707,7 +750,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/signify-netherlands-b-v-rdm001.json b/tests/data/devices/signify-netherlands-b-v-rdm001.json index c85ff8f14..414d81a2a 100644 --- a/tests/data/devices/signify-netherlands-b-v-rdm001.json +++ b/tests/data/devices/signify-netherlands-b-v-rdm001.json @@ -225,6 +225,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0b:02:b6:79-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:17:88:01:0b:02:b6:79:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0b:02:b6:79", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -239,7 +280,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/signify-netherlands-b-v-rdm002.json b/tests/data/devices/signify-netherlands-b-v-rdm002.json index d6a402f58..b883d1b15 100644 --- a/tests/data/devices/signify-netherlands-b-v-rdm002.json +++ b/tests/data/devices/signify-netherlands-b-v-rdm002.json @@ -241,6 +241,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0d:13:48:33-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:17:88:01:0d:13:48:33:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0d:13:48:33", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -255,7 +296,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/signify-netherlands-b-v-rwl022.json b/tests/data/devices/signify-netherlands-b-v-rwl022.json index 6cd5c1cbf..cc3012c9c 100644 --- a/tests/data/devices/signify-netherlands-b-v-rwl022.json +++ b/tests/data/devices/signify-netherlands-b-v-rwl022.json @@ -237,6 +237,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "00:17:88:01:0c:26:42:ec-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "00:17:88:01:0c:26:42:ec:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:17:88:01:0c:26:42:ec", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -251,7 +292,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/third-reality-inc-3rsb22bz.json b/tests/data/devices/third-reality-inc-3rsb22bz.json index 99bd7d22a..e8ebb9b52 100644 --- a/tests/data/devices/third-reality-inc-3rsb22bz.json +++ b/tests/data/devices/third-reality-inc-3rsb22bz.json @@ -141,6 +141,47 @@ }, "zha_lib_entities": { "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "28:2c:02:bf:ff:e3:74:f8-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "28:2c:02:bf:ff:e3:74:f8:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "28:2c:02:bf:ff:e3:74:f8", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -155,7 +196,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/third-reality-inc-3rss009z.json b/tests/data/devices/third-reality-inc-3rss009z.json index f0885a380..093d04907 100644 --- a/tests/data/devices/third-reality-inc-3rss009z.json +++ b/tests/data/devices/third-reality-inc-3rss009z.json @@ -147,6 +147,49 @@ }, "original_signature": {}, "zha_lib_entities": { + "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "28:2c:02:bf:ff:e9:77:95-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "28:2c:02:bf:ff:e9:77:95:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "28:2c:02:bf:ff:e9:77:95", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + } + ], "number": [ { "info_object": { @@ -398,7 +441,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "OnOffClusterHandler", diff --git a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json index d10ac8ce4..c104132a7 100644 --- a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json +++ b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json @@ -216,6 +216,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:66:b9:e7:ff-1-6", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "OnOffEvent", + "translation_key": "on_off", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "OnOffClientClusterHandler", + "generic_id": "cluster_handler_0x0006_client", + "endpoint_id": 1, + "cluster": { + "id": 6, + "name": "On/Off", + "type": "client" + }, + "id": "1:0x0006_client", + "unique_id": "ab:cd:ef:12:66:b9:e7:ff:1:0x0006_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:66:b9:e7:ff", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "OnOffEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -230,7 +271,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index df8fafbe8..489255535 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -22,7 +22,7 @@ ) from zha.application import Platform from zha.application.gateway import Gateway -from zha.application.platforms.event import BaseEvent +from zha.application.platforms.event import BaseEvent, LevelControlEvent, OnOffEvent IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e8" @@ -35,7 +35,7 @@ def zigpy_device_mock(zha_gateway: Gateway) -> ZigpyDevice: endpoints = { 1: { SIG_EP_INPUT: [], - SIG_EP_OUTPUT: [general.LevelControl.cluster_id], + SIG_EP_OUTPUT: [general.LevelControl.cluster_id, general.OnOff.cluster_id], SIG_EP_TYPE: zha.DeviceType.LEVEL_CONTROL_SWITCH, SIG_EP_PROFILE: zha.PROFILE_ID, } @@ -65,7 +65,7 @@ def zigpy_device_mock(zha_gateway: Gateway) -> ZigpyDevice: ) -async def test_event( +async def test_level_control_event( zha_gateway: Gateway, ) -> None: """Test zha fan platform.""" @@ -76,7 +76,9 @@ async def test_event( general.LevelControl.cluster_id ] - entity = get_entity(zha_device, platform=Platform.EVENT) + entity = get_entity( + zha_device, platform=Platform.EVENT, exact_entity_type=LevelControlEvent + ) assert isinstance(entity, BaseEvent) assert entity.event_types == [ "step", @@ -104,6 +106,42 @@ async def test_event( } +async def test_on_off_event( + zha_gateway: Gateway, +) -> None: + """Test zha fan platform.""" + + zigpy_device = zigpy_device_mock(zha_gateway) + zha_device = await join_zigpy_device(zha_gateway, zigpy_device) + cluster: general.OnOff = zigpy_device.endpoints.get(1).out_clusters[ + general.OnOff.cluster_id + ] + + entity = get_entity( + zha_device, platform=Platform.EVENT, exact_entity_type=OnOffEvent + ) + assert isinstance(entity, BaseEvent) + assert entity.event_types == [ + "off", + "on", + "toggle", + "off_with_effect", + "on_with_recall_global_scene", + "on_with_timed_off", + ] + + cmd = cluster.ServerCommandDefs.on + hdr = make_zcl_header(cmd.id, global_command=False, tsn=1) + msg = cmd.schema() + cluster.handle_message(hdr, msg) + assert entity.state == { + "event_attributes": {}, + "event_type": "on", + "available": True, + "class_name": "OnOffEvent", + } + + async def test_invalid_event( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, @@ -116,7 +154,9 @@ async def test_invalid_event( general.LevelControl.cluster_id ] - entity = get_entity(zha_device, platform=Platform.EVENT) + entity = get_entity( + zha_device, platform=Platform.EVENT, exact_entity_type=LevelControlEvent + ) assert isinstance(entity, BaseEvent) # cmd = general.OnOff.ServerCommandDefs.on diff --git a/zha/application/discovery.py b/zha/application/discovery.py index c8de8c222..9ec5bc4fc 100644 --- a/zha/application/discovery.py +++ b/zha/application/discovery.py @@ -494,9 +494,12 @@ def handle_on_off_output_cluster_exception( """Process output clusters of the endpoint.""" for cluster_id, cluster in endpoint.zigpy_endpoint.out_clusters.items(): - platform = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get(cluster.cluster_id) - if platform is None: + platforms = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get(cluster.cluster_id, []) + if not platforms: continue + # only get the first platform for this + # special construction. + platform = platforms[0] cluster_handler_classes = CLUSTER_HANDLER_REGISTRY.get( cluster_id, {None: ClusterHandler} @@ -529,13 +532,16 @@ def _handle_single_output_clusters( endpoint.claim_cluster_handlers([cluster_handler]) continue - platform = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get( + platforms = SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS.get( cluster_handler.cluster.cluster_id ) - if platform is None: + if not platforms: continue - yield from self.probe_single_cluster(platform, cluster_handler, endpoint) + for platform in platforms: + yield from self.probe_single_cluster( + platform, cluster_handler, endpoint + ) def discover_multi_entities( self, diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index fe51ce765..60d253796 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -15,12 +15,12 @@ from zha.const import STATE_CHANGED from zha.zigbee.cluster_handlers.const import ( CLIENT_CLUSTER_HANDLER_LEVEL, + CLIENT_CLUSTER_HANDLER_ON_OFF, CLUSTER_HANDLER_COMMAND_EVENT, ) if TYPE_CHECKING: - from zha.zigbee.cluster_handlers import ClusterHandler - from zha.zigbee.cluster_handlers.general import ClusterHandlerCommandEvent + from zha.zigbee.cluster_handlers import ClusterHandler, ClusterHandlerCommandEvent from enum import StrEnum @@ -126,3 +126,19 @@ class LevelControlEvent(ClusterHandlerEvent): "move_to_level_with_on_off", ] _cluster_handler_name = CLIENT_CLUSTER_HANDLER_LEVEL + + +@STRICT_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_ON_OFF) +class OnOffEvent(ClusterHandlerEvent): + """Representation of a ZHA fan.""" + + _attr_translation_key = "on_off" + _attr_event_types = [ + "off", + "on", + "toggle", + "off_with_effect", + "on_with_recall_global_scene", + "on_with_timed_off", + ] + _cluster_handler_name = CLIENT_CLUSTER_HANDLER_ON_OFF diff --git a/zha/application/registries.py b/zha/application/registries.py index c8764f864..032f8b967 100644 --- a/zha/application/registries.py +++ b/zha/application/registries.py @@ -59,9 +59,9 @@ } SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = { - zcl.clusters.general.LevelControl.cluster_id: Platform.EVENT, - zcl.clusters.general.OnOff.cluster_id: Platform.BINARY_SENSOR, - zcl.clusters.security.IasAce.cluster_id: Platform.ALARM_CONTROL_PANEL, + zcl.clusters.general.LevelControl.cluster_id: [Platform.EVENT], + zcl.clusters.general.OnOff.cluster_id: [Platform.BINARY_SENSOR, Platform.EVENT], + zcl.clusters.security.IasAce.cluster_id: [Platform.ALARM_CONTROL_PANEL], } DEVICE_CLASS = { diff --git a/zha/zigbee/cluster_handlers/__init__.py b/zha/zigbee/cluster_handlers/__init__.py index 45aeb386f..8d58517a4 100644 --- a/zha/zigbee/cluster_handlers/__init__.py +++ b/zha/zigbee/cluster_handlers/__init__.py @@ -37,6 +37,7 @@ ATTRIBUTE_VALUE, CLUSTER_HANDLER_ATTRIBUTE_UPDATED, CLUSTER_HANDLER_EVENT, + CLUSTER_HANDLER_COMMAND_EVENT, CLUSTER_HANDLER_ZDO, CLUSTER_ID, CLUSTER_READS_PER_REQ, @@ -90,6 +91,15 @@ async def wrapper(*args: P.args, **kwargs: P.kwargs) -> Any: return wrapper +@dataclass(frozen=True, kw_only=True) +class ClusterHandlerCommandEvent: + """Event to signal that a cluster command was received.""" + + event: str + event_type: Final[str] = "cluster_handler_event" + data: dict[str, Any] + + class AttrReportConfig(TypedDict, total=True): """Configuration to report for the attributes.""" @@ -757,8 +767,23 @@ def attribute_updated(self, attrid: int, value: Any, timestamp: datetime) -> Non def cluster_command(self, tsn, command_id, args): """Handle a cluster command received on this cluster.""" - if ( - self._cluster.server_commands is not None - and self._cluster.server_commands.get(command_id) is not None - ): - self.emit_zha_event(self._cluster.server_commands[command_id].name, args) + + parse_and_log_command(self, tsn, command_id, args) + + if (command := self._cluster.server_commands.get(command_id)) is None: + return + + # Emit standard zha event + self.emit_zha_event(command.name, args) + + # Some clusters emit empty lists and other types + if isinstance(args, CommandSchema): + data = args.as_dict(skip_missing=True, recursive=True) + else: + data = {} + + # Emit internal parsed event + self.emit( + CLUSTER_HANDLER_COMMAND_EVENT, + ClusterHandlerCommandEvent(event=command.name, data=data), + ) diff --git a/zha/zigbee/cluster_handlers/const.py b/zha/zigbee/cluster_handlers/const.py index b339dd159..170aa87ea 100644 --- a/zha/zigbee/cluster_handlers/const.py +++ b/zha/zigbee/cluster_handlers/const.py @@ -81,6 +81,7 @@ CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster" CLIENT_CLUSTER_HANDLER_LEVEL: Final[str] = CLUSTER_HANDLER_LEVEL + "_client" +CLIENT_CLUSTER_HANDLER_ON_OFF: Final[str] = CLUSTER_HANDLER_ON_OFF + "_client" CLIENT_CLUSTER_HANDLER_OTA: Final[str] = CLUSTER_HANDLER_OTA + "_client" AQARA_OPPLE_CLUSTER: Final[int] = 0xFCC0 diff --git a/zha/zigbee/cluster_handlers/general.py b/zha/zigbee/cluster_handlers/general.py index 0def5dc98..5cc15dd5b 100644 --- a/zha/zigbee/cluster_handlers/general.py +++ b/zha/zigbee/cluster_handlers/general.py @@ -79,15 +79,6 @@ class LevelChangeEvent: event_type: Final[str] = "cluster_handler_event" -@dataclass(frozen=True, kw_only=True) -class ClusterHandlerCommandEvent: - """Event to signal that a cluster command was received.""" - - event: str - event_type: Final[str] = "cluster_handler_event" - data: dict[str, Any] - - @registries.CLUSTER_HANDLER_REGISTRY.register(Alarms.cluster_id) class AlarmsClusterHandler(ClusterHandler): """Alarms cluster handler.""" @@ -422,25 +413,6 @@ def cluster_command(self, tsn, command_id, args): class LevelControlClientClusterHandler(ClientClusterHandler): """LevelControl client cluster.""" - def cluster_command(self, tsn: int, command_id: int, args: CommandSchema): - """Handle commands received to this cluster.""" - - parse_and_log_command(self, tsn, command_id, args) - - if (command := self._cluster.server_commands.get(command_id)) is None: - return - - # Emit standard zha event - self.emit_zha_event(command.name, args) - - # Emit internal parsed event - self.emit( - CLUSTER_HANDLER_COMMAND_EVENT, - ClusterHandlerCommandEvent( - event=command.name, data=args.as_dict(skip_missing=True, recursive=True) - ), - ) - @registries.BINDABLE_CLUSTERS.register(LevelControl.cluster_id) @registries.CLUSTER_HANDLER_REGISTRY.register(LevelControl.cluster_id) From 59beacdcc9b97fe6198261b5f35f35823d774790 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 21:01:37 +0000 Subject: [PATCH 08/11] Apply pre-commit auto fixes --- zha/zigbee/cluster_handlers/__init__.py | 2 +- zha/zigbee/cluster_handlers/general.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/zha/zigbee/cluster_handlers/__init__.py b/zha/zigbee/cluster_handlers/__init__.py index 8d58517a4..dc2fa1efa 100644 --- a/zha/zigbee/cluster_handlers/__init__.py +++ b/zha/zigbee/cluster_handlers/__init__.py @@ -36,8 +36,8 @@ ATTRIBUTE_NAME, ATTRIBUTE_VALUE, CLUSTER_HANDLER_ATTRIBUTE_UPDATED, - CLUSTER_HANDLER_EVENT, CLUSTER_HANDLER_COMMAND_EVENT, + CLUSTER_HANDLER_EVENT, CLUSTER_HANDLER_ZDO, CLUSTER_ID, CLUSTER_READS_PER_REQ, diff --git a/zha/zigbee/cluster_handlers/general.py b/zha/zigbee/cluster_handlers/general.py index 5cc15dd5b..e47517495 100644 --- a/zha/zigbee/cluster_handlers/general.py +++ b/zha/zigbee/cluster_handlers/general.py @@ -42,7 +42,7 @@ Time, ) from zigpy.zcl.clusters.general_const import ApplicationType -from zigpy.zcl.foundation import CommandSchema, Status +from zigpy.zcl.foundation import Status from zha.exceptions import ZHAException from zha.zigbee.cluster_handlers import ( @@ -53,7 +53,6 @@ registries, ) from zha.zigbee.cluster_handlers.const import ( - CLUSTER_HANDLER_COMMAND_EVENT, CLUSTER_HANDLER_LEVEL_CHANGED, REPORT_CONFIG_ASAP, REPORT_CONFIG_BATTERY_SAVE, From 03436159be0fcbe702fcaa66f9c64d7ad3853086 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 6 Dec 2025 00:23:05 +0100 Subject: [PATCH 09/11] Add color cluster events --- tests/data/devices/awox-tlsr82xx.json | 41 +++ .../data/devices/lds-zbt-cctswitch-d0001.json | 41 +++ .../devices/lumi-lumi-remote-b286opcn01.json | 41 +++ .../devices/lumi-lumi-remote-b486opcn01.json | 41 +++ .../devices/lumi-lumi-remote-b686opcn01.json | 41 +++ .../data/devices/mli-zbt-remote-all-rgbw.json | 41 +++ .../neuhaus-lighting-group-nlg-remote.json | 41 +++ .../devices/osram-switch-4x-lightify.json | 246 ++++++++++++++++++ .../data/devices/tz3000-gwkzibhs-ts004f.json | 43 ++- .../data/devices/tz3000-kjfzuycl-ts004f.json | 43 ++- .../data/devices/tz3000-xa9g7rxs-ts1002.json | 41 +++ tests/test_platform_event.py | 67 ++++- zha/application/platforms/event.py | 29 +++ zha/application/registries.py | 1 + zha/zigbee/cluster_handlers/const.py | 1 + 15 files changed, 753 insertions(+), 5 deletions(-) diff --git a/tests/data/devices/awox-tlsr82xx.json b/tests/data/devices/awox-tlsr82xx.json index 1237e7789..1212ac88e 100644 --- a/tests/data/devices/awox-tlsr82xx.json +++ b/tests/data/devices/awox-tlsr82xx.json @@ -241,6 +241,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "a4:c1:38:01:9c:d6:df:d1-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "a4:c1:38:01:9c:d6:df:d1:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "a4:c1:38:01:9c:d6:df:d1", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lds-zbt-cctswitch-d0001.json b/tests/data/devices/lds-zbt-cctswitch-d0001.json index aa27457e4..b3e572c45 100644 --- a/tests/data/devices/lds-zbt-cctswitch-d0001.json +++ b/tests/data/devices/lds-zbt-cctswitch-d0001.json @@ -278,6 +278,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "14:b4:57:ff:fe:81:56:33-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "14:b4:57:ff:fe:81:56:33:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "14:b4:57:ff:fe:81:56:33", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lumi-lumi-remote-b286opcn01.json b/tests/data/devices/lumi-lumi-remote-b286opcn01.json index ce38959e0..6b02dcd49 100644 --- a/tests/data/devices/lumi-lumi-remote-b286opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b286opcn01.json @@ -468,6 +468,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:67-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "04:cf:8c:df:3c:75:c1:67:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:67", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lumi-lumi-remote-b486opcn01.json b/tests/data/devices/lumi-lumi-remote-b486opcn01.json index 81ce2cb04..59f91214f 100755 --- a/tests/data/devices/lumi-lumi-remote-b486opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b486opcn01.json @@ -334,6 +334,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:75:c1:7b-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "04:cf:8c:df:3c:75:c1:7b:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:75:c1:7b", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/lumi-lumi-remote-b686opcn01.json b/tests/data/devices/lumi-lumi-remote-b686opcn01.json index 7fa26850a..d37c28bfe 100644 --- a/tests/data/devices/lumi-lumi-remote-b686opcn01.json +++ b/tests/data/devices/lumi-lumi-remote-b686opcn01.json @@ -442,6 +442,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "04:cf:8c:df:3c:79:47:76-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "04:cf:8c:df:3c:79:47:76:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "04:cf:8c:df:3c:79:47:76", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/mli-zbt-remote-all-rgbw.json b/tests/data/devices/mli-zbt-remote-all-rgbw.json index e932cc4e0..8a09e1e8f 100644 --- a/tests/data/devices/mli-zbt-remote-all-rgbw.json +++ b/tests/data/devices/mli-zbt-remote-all-rgbw.json @@ -593,6 +593,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:b1:2f:b5:32-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "ab:cd:ef:12:b1:2f:b5:32:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:b1:2f:b5:32", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json index e040dab0c..cbf3048ea 100644 --- a/tests/data/devices/neuhaus-lighting-group-nlg-remote.json +++ b/tests/data/devices/neuhaus-lighting-group-nlg-remote.json @@ -200,6 +200,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:90:e3:16:0a-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "ab:cd:ef:12:90:e3:16:0a:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:90:e3:16:0a", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/osram-switch-4x-lightify.json b/tests/data/devices/osram-switch-4x-lightify.json index 6303e8af7..64f1e66f2 100644 --- a/tests/data/devices/osram-switch-4x-lightify.json +++ b/tests/data/devices/osram-switch-4x-lightify.json @@ -799,6 +799,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -881,6 +922,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-2-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 2, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "2:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:2:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 2, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -963,6 +1045,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-3-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 3, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "3:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:3:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 3, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -1045,6 +1168,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-4-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 4, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "4:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:4:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 4, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -1127,6 +1291,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-5-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 5, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "5:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:5:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 5, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -1209,6 +1414,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:0d:6f:00:0e:c8:d4:e7-6-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 6, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "6:0x0300_client", + "unique_id": "00:0d:6f:00:0e:c8:d4:e7:6:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "00:0d:6f:00:0e:c8:d4:e7", + "endpoint_id": 6, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/tz3000-gwkzibhs-ts004f.json b/tests/data/devices/tz3000-gwkzibhs-ts004f.json index e5fb8728e..7a79d3183 100644 --- a/tests/data/devices/tz3000-gwkzibhs-ts004f.json +++ b/tests/data/devices/tz3000-gwkzibhs-ts004f.json @@ -298,6 +298,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:e5:79:a6:00-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "ab:cd:ef:12:e5:79:a6:00:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:e5:79:a6:00", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -312,7 +353,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/tz3000-kjfzuycl-ts004f.json b/tests/data/devices/tz3000-kjfzuycl-ts004f.json index 251ea4eb5..0ca4010a1 100644 --- a/tests/data/devices/tz3000-kjfzuycl-ts004f.json +++ b/tests/data/devices/tz3000-kjfzuycl-ts004f.json @@ -247,6 +247,47 @@ } ], "event": [ + { + "info_object": { + "fallback_name": null, + "unique_id": "38:5b:44:ff:fe:36:af:0f-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "38:5b:44:ff:fe:36:af:0f:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "38:5b:44:ff:fe:36:af:0f", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, @@ -261,7 +302,7 @@ "entity_category": null, "entity_registry_enabled_default": true, "enabled": true, - "primary": true, + "primary": false, "cluster_handlers": [ { "class_name": "LevelControlClientClusterHandler", diff --git a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json index c104132a7..bb05895ea 100644 --- a/tests/data/devices/tz3000-xa9g7rxs-ts1002.json +++ b/tests/data/devices/tz3000-xa9g7rxs-ts1002.json @@ -257,6 +257,47 @@ "available": true } }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:66:b9:e7:ff-1-768", + "migrate_unique_ids": [], + "platform": "event", + "class_name": "ColorEvent", + "translation_key": "color", + "translation_placeholders": null, + "device_class": null, + "state_class": null, + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ColorClientClusterHandler", + "generic_id": "cluster_handler_0x0300_client", + "endpoint_id": 1, + "cluster": { + "id": 768, + "name": "Color Control", + "type": "client" + }, + "id": "1:0x0300_client", + "unique_id": "ab:cd:ef:12:66:b9:e7:ff:1:0x0300_CLIENT", + "status": "INITIALIZED", + "value_attribute": null + } + ], + "device_ieee": "ab:cd:ef:12:66:b9:e7:ff", + "endpoint_id": 1, + "available": true, + "group_id": null + }, + "state": { + "class_name": "ColorEvent", + "available": true + } + }, { "info_object": { "fallback_name": null, diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index 489255535..887f52d38 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -7,7 +7,7 @@ import pytest from zigpy.device import Device as ZigpyDevice from zigpy.profiles import zha -from zigpy.zcl.clusters import general +from zigpy.zcl.clusters import general, lighting import zigpy.zdo.types as zdo_t from tests.common import ( @@ -22,7 +22,12 @@ ) from zha.application import Platform from zha.application.gateway import Gateway -from zha.application.platforms.event import BaseEvent, LevelControlEvent, OnOffEvent +from zha.application.platforms.event import ( + BaseEvent, + LevelControlEvent, + OnOffEvent, + ColorEvent, +) IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e8" @@ -35,7 +40,11 @@ def zigpy_device_mock(zha_gateway: Gateway) -> ZigpyDevice: endpoints = { 1: { SIG_EP_INPUT: [], - SIG_EP_OUTPUT: [general.LevelControl.cluster_id, general.OnOff.cluster_id], + SIG_EP_OUTPUT: [ + general.LevelControl.cluster_id, + general.OnOff.cluster_id, + lighting.Color.cluster_id, + ], SIG_EP_TYPE: zha.DeviceType.LEVEL_CONTROL_SWITCH, SIG_EP_PROFILE: zha.PROFILE_ID, } @@ -106,6 +115,58 @@ async def test_level_control_event( } +async def test_color_event( + zha_gateway: Gateway, +) -> None: + """Test zha fan platform.""" + + zigpy_device = zigpy_device_mock(zha_gateway) + zha_device = await join_zigpy_device(zha_gateway, zigpy_device) + cluster: lighting.Color = zigpy_device.endpoints.get(1).out_clusters[ + lighting.Color.cluster_id + ] + + entity = get_entity( + zha_device, platform=Platform.EVENT, exact_entity_type=ColorEvent + ) + assert isinstance(entity, BaseEvent) + assert entity.event_types == [ + "move_to_huemove_hue", + "step_hue", + "move_to_saturation", + "move_saturation", + "step_saturation", + "move_to_hue_and_saturation", + "move_to_color", + "move_color", + "step_color", + "move_to_color_temp", + "enhanced_move_to_hue", + "enhanced_move_hue", + "enhanced_step_hue", + "enhanced_move_to_hue_and_saturation", + "color_loop_set", + "stop_move_step", + "move_color_temp", + "step_color_temp", + ] + + cmd = cluster.ServerCommandDefs.step_color_temp + hdr = make_zcl_header(cmd.id, global_command=False, tsn=1) + msg = cmd.schema(step_mode=1, step_size=10, transition_time=5) + cluster.handle_message(hdr, msg) + assert entity.state == { + "event_attributes": { + "step_mode": 1, + "step_size": 10, + "transition_time": 5, + }, + "event_type": "step_color_temp", + "available": True, + "class_name": "ColorEvent", + } + + async def test_on_off_event( zha_gateway: Gateway, ) -> None: diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index 60d253796..2a8a755b7 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -16,6 +16,7 @@ from zha.zigbee.cluster_handlers.const import ( CLIENT_CLUSTER_HANDLER_LEVEL, CLIENT_CLUSTER_HANDLER_ON_OFF, + CLIENT_CLUSTER_HANDLER_COLOR, CLUSTER_HANDLER_COMMAND_EVENT, ) @@ -142,3 +143,31 @@ class OnOffEvent(ClusterHandlerEvent): "on_with_timed_off", ] _cluster_handler_name = CLIENT_CLUSTER_HANDLER_ON_OFF + + +@STRICT_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_COLOR) +class ColorEvent(ClusterHandlerEvent): + """Representation of a ZHA fan.""" + + _attr_translation_key = "color" + _attr_event_types = [ + "move_to_huemove_hue", + "step_hue", + "move_to_saturation", + "move_saturation", + "step_saturation", + "move_to_hue_and_saturation", + "move_to_color", + "move_color", + "step_color", + "move_to_color_temp", + "enhanced_move_to_hue", + "enhanced_move_hue", + "enhanced_step_hue", + "enhanced_move_to_hue_and_saturation", + "color_loop_set", + "stop_move_step", + "move_color_temp", + "step_color_temp", + ] + _cluster_handler_name = CLIENT_CLUSTER_HANDLER_COLOR diff --git a/zha/application/registries.py b/zha/application/registries.py index 032f8b967..ee2f88b79 100644 --- a/zha/application/registries.py +++ b/zha/application/registries.py @@ -59,6 +59,7 @@ } SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = { + zcl.clusters.lighting.Color.cluster_id: [Platform.EVENT], zcl.clusters.general.LevelControl.cluster_id: [Platform.EVENT], zcl.clusters.general.OnOff.cluster_id: [Platform.BINARY_SENSOR, Platform.EVENT], zcl.clusters.security.IasAce.cluster_id: [Platform.ALARM_CONTROL_PANEL], diff --git a/zha/zigbee/cluster_handlers/const.py b/zha/zigbee/cluster_handlers/const.py index 170aa87ea..f3cff97a7 100644 --- a/zha/zigbee/cluster_handlers/const.py +++ b/zha/zigbee/cluster_handlers/const.py @@ -80,6 +80,7 @@ ZONE: Final[str] = CLUSTER_HANDLER_ZONE CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster" +CLIENT_CLUSTER_HANDLER_COLOR: Final[str] = CLUSTER_HANDLER_COLOR + "_client" CLIENT_CLUSTER_HANDLER_LEVEL: Final[str] = CLUSTER_HANDLER_LEVEL + "_client" CLIENT_CLUSTER_HANDLER_ON_OFF: Final[str] = CLUSTER_HANDLER_ON_OFF + "_client" CLIENT_CLUSTER_HANDLER_OTA: Final[str] = CLUSTER_HANDLER_OTA + "_client" From 0c5a622079e8eaa56010fd7759b920ba76b9a369 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 23:39:11 +0000 Subject: [PATCH 10/11] Apply pre-commit auto fixes --- tests/test_platform_event.py | 2 +- zha/application/platforms/event.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index 887f52d38..7c6c16dc0 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -24,9 +24,9 @@ from zha.application.gateway import Gateway from zha.application.platforms.event import ( BaseEvent, + ColorEvent, LevelControlEvent, OnOffEvent, - ColorEvent, ) IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index 2a8a755b7..aea833393 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -14,9 +14,9 @@ from zha.application.registries import PLATFORM_ENTITIES from zha.const import STATE_CHANGED from zha.zigbee.cluster_handlers.const import ( + CLIENT_CLUSTER_HANDLER_COLOR, CLIENT_CLUSTER_HANDLER_LEVEL, CLIENT_CLUSTER_HANDLER_ON_OFF, - CLIENT_CLUSTER_HANDLER_COLOR, CLUSTER_HANDLER_COMMAND_EVENT, ) From 79f4880c7e50e6061d8f6e880b983b2c3cea940e Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 6 Dec 2025 01:06:44 +0100 Subject: [PATCH 11/11] Corrected invalid hue event --- tests/test_platform_event.py | 3 ++- zha/application/platforms/event.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_platform_event.py b/tests/test_platform_event.py index 7c6c16dc0..77e0634c9 100644 --- a/tests/test_platform_event.py +++ b/tests/test_platform_event.py @@ -131,7 +131,8 @@ async def test_color_event( ) assert isinstance(entity, BaseEvent) assert entity.event_types == [ - "move_to_huemove_hue", + "move_to_hue", + "move_hue", "step_hue", "move_to_saturation", "move_saturation", diff --git a/zha/application/platforms/event.py b/zha/application/platforms/event.py index aea833393..fabcb5b2a 100644 --- a/zha/application/platforms/event.py +++ b/zha/application/platforms/event.py @@ -151,7 +151,8 @@ class ColorEvent(ClusterHandlerEvent): _attr_translation_key = "color" _attr_event_types = [ - "move_to_huemove_hue", + "move_to_hue", + "move_hue", "step_hue", "move_to_saturation", "move_saturation",