mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-15 14:48:43 +00:00
Re-query missing responses after multi request errors (#850)
When smart devices encounter an error during a multipleRequest they return the previous successes and the current error and stop processing subsequent requests. This checks the responses returned and re-queries individually for any missing responses so that individual errors do not break other components.
This commit is contained in:
@@ -113,6 +113,9 @@ class FakeSmartTransport(BaseTransport):
|
||||
responses = []
|
||||
for request in params["requests"]:
|
||||
response = self._send_request(request) # type: ignore[arg-type]
|
||||
# Devices do not continue after error
|
||||
if response["error_code"] != 0:
|
||||
break
|
||||
response["method"] = request["method"] # type: ignore[index]
|
||||
responses.append(response)
|
||||
return {"result": {"responses": responses}, "error_code": 0}
|
||||
|
||||
Reference in New Issue
Block a user