Skip to content

Commit b18b0dd

Browse files
authored
Merge pull request #287 from wbyoung/fix-zcl-cmd
Fix `zcl_cmd`
2 parents 56a7223 + 2fc450d commit b18b0dd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

custom_components/zha_toolkit/zcl_cmd.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,21 @@ async def zcl_cmd(app, listener, ieee, cmd, data, service, params, event_data):
9898
False,
9999
)
100100
elif cmd_id not in cluster.server_commands:
101-
cmd_schema: list[Any] = []
101+
schema_dict: dict[str, Any] = {}
102102

103103
if cmd_args is not None:
104-
cmd_schema = [t.uint8_t] * len(cmd_args)
104+
schema_dict = {
105+
f"param{i + 1}": t.uint8_t
106+
for i in range(len(cmd_args))
107+
}
105108

109+
temp = foundation.ZCLCommandDef(
110+
schema=schema_dict,
111+
direction=foundation.Direction.Client_to_Server,
112+
id=cmd_id,
113+
name="schema",
114+
)
115+
cmd_schema = temp.with_compiled_schema().schema
106116
cmd_def = foundation.ZCLCommandDef(
107117
name=f"zha_toolkit_dummy_cmd{cmd_id}",
108118
id=cmd_id,

0 commit comments

Comments
 (0)