Skip to content

Commit

Permalink
Fix to repair 'access' field text represention (because of zigpy change)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Oct 16, 2023
1 parent 50c46d5 commit 33d6086
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions custom_components/zha_toolkit/scan_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio
import logging
import re

from zigpy import types as t
from zigpy.exceptions import ControllerException, DeliveryError
Expand All @@ -14,6 +13,9 @@
LOGGER = logging.getLogger(__name__)


ACCESS_CONTROL_MAP = {0x01: "READ", 0x02: "WRITE", 0x04: "REPORT"}


@u.retryable(
(
DeliveryError,
Expand Down Expand Up @@ -231,13 +233,16 @@ async def discover_attributes_extended(cluster, manufacturer=None, tries=3):
]
else:
attr_type = attr_type_hex
try:
access = re.sub(
"^.*\\.",
"",
str(foundation.AttributeAccessControl(access_acl)),

if access_acl != 0:
access = "|".join(
[
s
for x, s in ACCESS_CONTROL_MAP.items()
if x & access_acl != 0
]
)
except ValueError:
else:
access = "undefined"

result[attr_id] = {
Expand Down

0 comments on commit 33d6086

Please sign in to comment.