Skip to content

Commit

Permalink
Merge pull request #56 from mdeweerd/dev
Browse files Browse the repository at this point in the history
Fix issue with scan_device discovered commands args not being iterable
  • Loading branch information
mdeweerd authored Apr 14, 2022
2 parents 953b875 + 0b8edb5 commit 6363454
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/zha_toolkit/scan_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,14 @@ async def discover_commands_received(cluster, is_server, manufacturer=None):
cmd_id, (str(cmd_id), "not_in_zcl", None)
)
cmd_name, cmd_args, _ = cmd_data

if not isinstance(cmd_args, str):
cmd_args = [arg.__name__ for arg in cmd_args]
if hasattr(cmd_args, "__iter__"):
cmd_args = [arg.__name__ for arg in cmd_args]
else:
# Unexpected type, get repr to make sure it is ok for json
cmd_args = f"{cmd_args!r}"

key = f"0x{cmd_id:02x}"
result[key] = {
"command_id": f"0x{cmd_id:02x}",
Expand Down

0 comments on commit 6363454

Please sign in to comment.