Skip to content

Commit

Permalink
Adjust the code to send commands to comply with zigpy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Jan 4, 2025
1 parent 942d0cc commit 0ed1989
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions custom_components/zha_toolkit/zcl_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,30 @@ async def zcl_cmd(app, listener, ieee, cmd, data, service, params, event_data):

if (cluster_id == 5) and (cmd_id == 0):
org_cluster_cmd_defs[0] = cluster.server_commands[0]
command = foundation.ZCLCommandDev(
name="zha_cltr5_cmd0",
id=0x00,
schema={
"param1": t.uint16_t,
"param2": t.uint8_t,
"param3": t.uint16_t,
"param4": t.CharacterString,
"param5?": t.List[t.uint8_t],
},
).with_compiled_schema()

cluster.server_commands[0] = (
"add",
(
t.uint16_t,
t.uint8_t,
t.uint16_t,
t.CharacterString,
t.Optional(t.List[t.uint8_t]),
),
command.schema,
False,
)
elif cmd_id not in cluster.server_commands:
cmd_schema: list[Any] = []

if cmd_args is not None:
cmd_schema = [t.uint8_t] * len(cmd_args)
cmd_schema = {

Check failure on line 110 in custom_components/zha_toolkit/zcl_cmd.py

View workflow job for this annotation

GitHub Actions / pre-commit

Incompatible types in assignment (expression has type "dict[str, Any]", variable has type "list[Any]") [assignment]
f"param{i+1}?": t.uint8_t for i in range(len(cmd_args))
}

cmd_def = foundation.ZCLCommandDef(
name=f"zha_toolkit_dummy_cmd{cmd_id}",
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"filename": "zha-toolkit.zip",
"render_readme": true,
"persistent_directory": "local",
"homeassistant": "2024.9.0"
"homeassistant": "2024.11.0"
}

0 comments on commit 0ed1989

Please sign in to comment.