diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7fac809e115b6e..6681ef4bafd04a 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -958,7 +958,9 @@ def SendCommand(self, device: ctypes.c_void_p, cluster: str, command: str, endpo if not func: raise UnknownCommand(cluster, command) funcCaller = self._ChipStack.Call if imEnabled else self._ChipStack.CallAsync - funcCaller(lambda: func(device, endpoint, groupid, **args)) + res = funcCaller(lambda: func(device, endpoint, groupid, **args)) + if res != 0: + raise self._ChipStack.ErrorToException(res) def ReadAttribute(self, device: ctypes.c_void_p, cluster: str, attribute: str, endpoint: int, groupid: int, imEnabled): func = getattr(self, "Cluster{}_ReadAttribute{}".format(cluster, attribute), None) diff --git a/src/controller/python/templates/python-CHIPClusters-py.zapt b/src/controller/python/templates/python-CHIPClusters-py.zapt index 7badb8e85b0a50..9636349faed269 100644 --- a/src/controller/python/templates/python-CHIPClusters-py.zapt +++ b/src/controller/python/templates/python-CHIPClusters-py.zapt @@ -50,7 +50,9 @@ class ChipClusters: if not func: raise UnknownCommand(cluster, command) funcCaller = self._ChipStack.Call if imEnabled else self._ChipStack.CallAsync - funcCaller(lambda: func(device, endpoint, groupid, **args)) + res = funcCaller(lambda: func(device, endpoint, groupid, **args)) + if res != 0: + raise self._ChipStack.ErrorToException(res) def ReadAttribute(self, device: ctypes.c_void_p, cluster: str, attribute: str, endpoint: int, groupid: int, imEnabled): func = getattr(self, "Cluster{}_ReadAttribute{}".format(cluster, attribute), None)