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:
Steven B
2024-04-20 16:24:49 +01:00
committed by GitHub
parent aeb2c923c6
commit 214b26a1ea
3 changed files with 23 additions and 6 deletions

View File

@@ -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}