Skip to content

Commit

Permalink
Merge pull request #59 from mdeweerd/dev
Browse files Browse the repository at this point in the history
Compatibility with zigpy 0.44.2 for read_report_configuration
  • Loading branch information
mdeweerd authored Apr 22, 2022
2 parents dba07c7 + dda5fd1 commit c5c5b75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions STATS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Badges showing number of downloads per version

- ![badge latest](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/latest/total.svg)
- ![badge v0.8.4](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.8.4/total.svg)
- ![badge v0.8.3](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.8.3/total.svg)
- ![badge v0.8.2](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.8.2/total.svg)
- ![badge v0.8.1](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.8.1/total.svg)
- ![badge v0.8.0](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.8.0/total.svg)
- ![badge v0.7.27](https://img.shields.io/github/downloads/mdeweerd/zha-toolkit/v0.7.27/total.svg)
Expand Down
12 changes: 11 additions & 1 deletion custom_components/zha_toolkit/zcl_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@
def read_reporting_configuration(
self, cfg: t.List[f.ReadReportingConfigRecord], **kwargs
):
schema = f.COMMANDS[0x08][0]
command = f.COMMANDS[0x08]
if isinstance(command, f.ZCLCommandDef):
# Since zigpy 0.44.0
schema = command.schema
else:
# Before zigpy 0.44.0
schema = command[0]

# LOGGER.error(f"SELF:{self!r}")
# LOGGER.error(f"COMMAND:{command!r}")
# LOGGER.error(f"SCHEMA:{schema!r}")
# data = t.serialize([cfg], schema)
# LOGGER.error(f"SERIALIZED:{data!r}")
Expand Down Expand Up @@ -71,6 +79,8 @@ async def my_read_reporting_configuration_multiple(
# LOGGER.warn(f"Record {record.direction} {record.attrid}")
cfg.append(record)
LOGGER.warn("Read reporting with %s", cfg)
param = t.List[f.ReadReportingConfigRecord](cfg)
LOGGER.debug("Resolves to %s", param)

# Exception is propagated to caller if any
res = await self._read_reporting_configuration(
Expand Down

0 comments on commit c5c5b75

Please sign in to comment.