From b1768895c75c38513fe5f50f93a9710dd12d5ada Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 24 Jan 2022 21:52:08 +0100 Subject: [PATCH] Limitation of zigpy, check if tries present in cluster.command parameter list --- custom_components/zha_toolkit/zcl_cmd.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/custom_components/zha_toolkit/zcl_cmd.py b/custom_components/zha_toolkit/zcl_cmd.py index e06353b..24d3ffb 100644 --- a/custom_components/zha_toolkit/zcl_cmd.py +++ b/custom_components/zha_toolkit/zcl_cmd.py @@ -1,4 +1,5 @@ import logging +import inspect from . import utils as u @@ -104,13 +105,21 @@ async def zcl_cmd(app, listener, ieee, cmd, data, service, event_data={}, params ), False, ) - await cluster.command( - cmd_id, - *cmd_args, - manufacturer=manf, - expect_reply=expect_reply, - tries=tries, - ) + if "tries" in inspect.getfullargspec(cluster.command)[0]: + await cluster.command( + cmd_id, + *cmd_args, + manufacturer=manf, + expect_reply=expect_reply, + tries=tries, + ) + else: + await cluster.command( + cmd_id, + *cmd_args, + manufacturer=manf, + expect_reply=expect_reply, + ) else: if cluster_id not in endpoint.out_clusters: msg = ERR005_NOT_OUT_CLUSTER.format(cluster_id, repr(ieee), ep_id)