Skip to content

Commit

Permalink
Merge branch 'add-array-type' of github.com:tomasbedrich/zha-toolkit …
Browse files Browse the repository at this point in the history
…into add-array-type
  • Loading branch information
mdeweerd committed Oct 24, 2023
2 parents 62decba + 994a91f commit 6568a6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 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 @@ -232,13 +234,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
6 changes: 1 addition & 5 deletions custom_components/zha_toolkit/zcl_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,7 @@ async def attr_write( # noqa: C901
attr_type = params[p.ATTR_TYPE]

result_read = None
if (
params[p.READ_BEFORE_WRITE]
or (len(attr_write_list) == 0)
or (cmd != S.ATTR_WRITE)
):
if params[p.READ_BEFORE_WRITE] or (attr_read_list and cmd == S.ATTR_READ):
if use_cache > 0:
# Try to get value from cache
if attr_id in cluster._attr_cache:
Expand Down

0 comments on commit 6568a6e

Please sign in to comment.