mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Extend ZHA attribute diagnostic information (#123199)
* Include full attribute representation in in data * Extend attribute diagnostics for zha
This commit is contained in:
parent
0558c85b5d
commit
f53da62026
@ -7,7 +7,7 @@ from importlib.metadata import version
|
||||
from typing import Any
|
||||
|
||||
from zha.application.const import (
|
||||
ATTR_ATTRIBUTE_NAME,
|
||||
ATTR_ATTRIBUTE,
|
||||
ATTR_DEVICE_TYPE,
|
||||
ATTR_IEEE,
|
||||
ATTR_IN_CLUSTERS,
|
||||
@ -158,27 +158,13 @@ def get_endpoint_cluster_attr_data(zha_device: Device) -> dict:
|
||||
|
||||
def get_cluster_attr_data(cluster: Cluster) -> dict:
|
||||
"""Return cluster attribute data."""
|
||||
unsupported_attributes = {}
|
||||
for u_attr in cluster.unsupported_attributes:
|
||||
try:
|
||||
u_attr_def = cluster.find_attribute(u_attr)
|
||||
unsupported_attributes[f"0x{u_attr_def.id:04x}"] = {
|
||||
ATTR_ATTRIBUTE_NAME: u_attr_def.name
|
||||
}
|
||||
except KeyError:
|
||||
if isinstance(u_attr, int):
|
||||
unsupported_attributes[f"0x{u_attr:04x}"] = {}
|
||||
else:
|
||||
unsupported_attributes[u_attr] = {}
|
||||
|
||||
return {
|
||||
ATTRIBUTES: {
|
||||
f"0x{attr_id:04x}": {
|
||||
ATTR_ATTRIBUTE_NAME: attr_def.name,
|
||||
ATTR_VALUE: attr_value,
|
||||
ATTR_ATTRIBUTE: repr(attr_def),
|
||||
ATTR_VALUE: cluster.get(attr_def.name),
|
||||
}
|
||||
for attr_id, attr_def in cluster.attributes.items()
|
||||
if (attr_value := cluster.get(attr_def.name)) is not None
|
||||
},
|
||||
UNSUPPORTED_ATTRIBUTES: unsupported_attributes,
|
||||
UNSUPPORTED_ATTRIBUTES: cluster.unsupported_attributes,
|
||||
}
|
||||
|
@ -161,8 +161,20 @@
|
||||
'in_clusters': dict({
|
||||
'0x0500': dict({
|
||||
'attributes': dict({
|
||||
'0x0000': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0x0000, name='zone_state', type=<enum 'ZoneState'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0x0001': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0x0001, name='zone_type', type=<enum 'ZoneType'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0x0002': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0x0002, name='zone_status', type=<flag 'ZoneStatus'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0x0010': dict({
|
||||
'attribute_name': 'cie_addr',
|
||||
'attribute': "ZCLAttributeDef(id=0x0010, name='cie_addr', type=<class 'zigpy.types.named.EUI64'>, access=<ZCLAttributeAccess.Read|Write: 3>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': list([
|
||||
50,
|
||||
79,
|
||||
@ -174,27 +186,41 @@
|
||||
0,
|
||||
]),
|
||||
}),
|
||||
}),
|
||||
'endpoint_attribute': 'ias_zone',
|
||||
'unsupported_attributes': dict({
|
||||
'0x0011': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0x0011, name='zone_id', type=<class 'zigpy.types.basic.uint8_t'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0x0012': dict({
|
||||
'attribute_name': 'num_zone_sensitivity_levels_supported',
|
||||
'attribute': "ZCLAttributeDef(id=0x0012, name='num_zone_sensitivity_levels_supported', type=<class 'zigpy.types.basic.uint8_t'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=False, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0x0013': dict({
|
||||
'attribute_name': 'current_zone_sensitivity_level',
|
||||
'attribute': "ZCLAttributeDef(id=0x0013, name='current_zone_sensitivity_level', type=<class 'zigpy.types.basic.uint8_t'>, access=<ZCLAttributeAccess.Read|Write: 3>, mandatory=False, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
}),
|
||||
'endpoint_attribute': 'ias_zone',
|
||||
'unsupported_attributes': list([
|
||||
18,
|
||||
'current_zone_sensitivity_level',
|
||||
]),
|
||||
}),
|
||||
'0x0501': dict({
|
||||
'attributes': dict({
|
||||
'0xfffd': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0xFFFD, name='cluster_revision', type=<class 'zigpy.types.basic.uint16_t'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
'0xfffe': dict({
|
||||
'attribute': "ZCLAttributeDef(id=0xFFFE, name='reporting_status', type=<enum 'AttributeReportingStatus'>, access=<ZCLAttributeAccess.Read: 1>, mandatory=False, is_manufacturer_specific=False)",
|
||||
'value': None,
|
||||
}),
|
||||
}),
|
||||
'endpoint_attribute': 'ias_ace',
|
||||
'unsupported_attributes': dict({
|
||||
'0x1000': dict({
|
||||
}),
|
||||
'unknown_attribute_name': dict({
|
||||
}),
|
||||
}),
|
||||
'unsupported_attributes': list([
|
||||
4096,
|
||||
'unknown_attribute_name',
|
||||
]),
|
||||
}),
|
||||
}),
|
||||
'out_clusters': dict({
|
||||
|
Loading…
x
Reference in New Issue
Block a user