Skip to content

Commit 86e9461

Browse files
committed
Clusters are matched on name, so ensure names suffixed by client
1 parent 6dfee7e commit 86e9461

File tree

8 files changed

+13
-64
lines changed

8 files changed

+13
-64
lines changed

tests/data/devices/lumi-lumi-remote-cagl02.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -440,20 +440,6 @@
440440
"enabled": true,
441441
"primary": false,
442442
"cluster_handlers": [
443-
{
444-
"class_name": "OtaClusterHandler",
445-
"generic_id": "cluster_handler_0x0019",
446-
"endpoint_id": 1,
447-
"cluster": {
448-
"id": 25,
449-
"name": "Ota",
450-
"type": "server"
451-
},
452-
"id": "1:0x0019",
453-
"unique_id": "54:ef:44:10:00:14:f3:e7:1:0x0019",
454-
"status": "INITIALIZED",
455-
"value_attribute": null
456-
},
457443
{
458444
"class_name": "OtaClientClusterHandler",
459445
"generic_id": "cluster_handler_0x0019_client",

tests/data/devices/lumi-lumi-sensor-86sw2.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -587,20 +587,6 @@
587587
"enabled": true,
588588
"primary": false,
589589
"cluster_handlers": [
590-
{
591-
"class_name": "OtaClusterHandler",
592-
"generic_id": "cluster_handler_0x0019",
593-
"endpoint_id": 1,
594-
"cluster": {
595-
"id": 25,
596-
"name": "Ota",
597-
"type": "server"
598-
},
599-
"id": "1:0x0019",
600-
"unique_id": "00:15:8d:00:02:54:cb:fa:1:0x0019",
601-
"status": "INITIALIZED",
602-
"value_attribute": null
603-
},
604590
{
605591
"class_name": "OtaClientClusterHandler",
606592
"generic_id": "cluster_handler_0x0019_client",

tests/data/devices/lumi-lumi-vibration-aq1.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -575,20 +575,6 @@
575575
"enabled": true,
576576
"primary": false,
577577
"cluster_handlers": [
578-
{
579-
"class_name": "OtaClusterHandler",
580-
"generic_id": "cluster_handler_0x0019",
581-
"endpoint_id": 1,
582-
"cluster": {
583-
"id": 25,
584-
"name": "Ota",
585-
"type": "server"
586-
},
587-
"id": "1:0x0019",
588-
"unique_id": "00:15:8d:00:02:af:97:27:1:0x0019",
589-
"status": "INITIALIZED",
590-
"value_attribute": null
591-
},
592578
{
593579
"class_name": "OtaClientClusterHandler",
594580
"generic_id": "cluster_handler_0x0019_client",

tests/data/devices/somfy-sonesse-28-wf-li-ion-roller.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -585,20 +585,6 @@
585585
"enabled": true,
586586
"primary": false,
587587
"cluster_handlers": [
588-
{
589-
"class_name": "OtaClusterHandler",
590-
"generic_id": "cluster_handler_0x0019",
591-
"endpoint_id": 232,
592-
"cluster": {
593-
"id": 25,
594-
"name": "Ota",
595-
"type": "server"
596-
},
597-
"id": "232:0x0019",
598-
"unique_id": "ab:cd:ef:12:7b:7c:3f:a7:232:0x0019",
599-
"status": "INITIALIZED",
600-
"value_attribute": null
601-
},
602588
{
603589
"class_name": "OtaClientClusterHandler",
604590
"generic_id": "cluster_handler_0x0019_client",

tests/data/devices/third-reality-inc-3rss007z.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
"unique_id": "28:2c:02:bf:ff:e0:16:01-1-25-firmware_update",
292292
"migrate_unique_ids": [],
293293
"platform": "update",
294-
"class_name": "FirmwareUpdateEntity",
294+
"class_name": "FirmwareUpdateServerEntity",
295295
"translation_key": null,
296296
"translation_placeholders": null,
297297
"device_class": "firmware",
@@ -323,7 +323,7 @@
323323
"supported_features": 7
324324
},
325325
"state": {
326-
"class_name": "FirmwareUpdateEntity",
326+
"class_name": "FirmwareUpdateServerEntity",
327327
"available": true,
328328
"installed_version": null,
329329
"in_progress": false,

zha/application/platforms/update.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from zha.zigbee.cluster_handlers.const import (
2222
CLUSTER_HANDLER_ATTRIBUTE_UPDATED,
2323
CLUSTER_HANDLER_OTA,
24-
CLUSTER_HANDLER_OTA_SERVER,
24+
CLIENT_CLUSTER_HANDLER_OTA,
2525
)
2626
from zha.zigbee.endpoint import Endpoint
2727

@@ -265,7 +265,7 @@ async def on_remove(self) -> None:
265265
await super().on_remove()
266266

267267

268-
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA)
268+
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLIENT_CLUSTER_HANDLER_OTA)
269269
class FirmwareUpdateEntity(BaseFirmwareUpdateEntity):
270270
"""Representation of a ZHA firmware update entity."""
271271

@@ -282,7 +282,7 @@ def __init__(
282282
super().__init__(cluster_handlers, endpoint, device, **kwargs)
283283

284284
self._ota_cluster_handler: ClusterHandler = self.cluster_handlers[
285-
CLUSTER_HANDLER_OTA
285+
CLIENT_CLUSTER_HANDLER_OTA
286286
]
287287
self._attr_installed_version: str | None = self._get_cluster_version()
288288
self._compatible_images: OtaImagesResult = OtaImagesResult(
@@ -312,7 +312,7 @@ def _get_cluster_version(self) -> str | None:
312312
return None
313313

314314

315-
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA_SERVER)
315+
@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_OTA)
316316
class FirmwareUpdateServerEntity(BaseFirmwareUpdateEntity):
317317
"""Representation of a ZHA firmware update entity."""
318318

@@ -330,7 +330,7 @@ def __init__(
330330

331331
# Some devices make it a server cluster, not a client cluster...
332332
self._ota_cluster_handler: ClusterHandler = self.cluster_handlers[
333-
CLUSTER_HANDLER_OTA_SERVER
333+
CLUSTER_HANDLER_OTA
334334
]
335335
self._attr_installed_version: str | None = self._get_cluster_version()
336336
self._compatible_images: OtaImagesResult = OtaImagesResult(

zha/zigbee/cluster_handlers/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,11 @@ def __init__(self, *args, **kwargs) -> None:
731731
self._generic_id += "_client"
732732
self._id += "_client"
733733

734+
@functools.cached_property
735+
def name(self) -> str:
736+
"""Return friendly name."""
737+
return self.cluster.ep_attribute + "_client" or self._generic_id
738+
734739
def attribute_updated(self, attrid: int, value: Any, timestamp: datetime) -> None:
735740
"""Handle an attribute updated on this cluster."""
736741
super().attribute_updated(attrid, value, timestamp)

zha/zigbee/cluster_handlers/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
CLUSTER_HANDLER_OCCUPANCY: Final[str] = "occupancy"
6969
CLUSTER_HANDLER_ON_OFF: Final[str] = "on_off"
7070
CLUSTER_HANDLER_OTA: Final[str] = "ota"
71-
CLUSTER_HANDLER_OTA_SERVER: Final[str] = "ota_server"
7271
CLUSTER_HANDLER_POWER_CONFIGURATION: Final[str] = "power"
7372
CLUSTER_HANDLER_PRESSURE: Final[str] = "pressure"
7473
CLUSTER_HANDLER_SHADE: Final[str] = "shade"
@@ -81,6 +80,7 @@
8180
ZONE: Final[str] = CLUSTER_HANDLER_ZONE
8281
CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster"
8382

83+
CLIENT_CLUSTER_HANDLER_OTA: Final[str] = CLUSTER_HANDLER_OTA + "_client"
8484
AQARA_OPPLE_CLUSTER: Final[int] = 0xFCC0
8585
IKEA_AIR_PURIFIER_CLUSTER: Final[int] = 0xFC7D
8686
IKEA_REMOTE_CLUSTER: Final[int] = 0xFC80

0 commit comments

Comments
 (0)