mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-16 04:18:01 +00:00
Merge branch 'master' into feat/smartcam_passthrough
This commit is contained in:
@@ -185,18 +185,18 @@ class SmartProtocol(BaseProtocol):
|
||||
multi_result: dict[str, Any] = {}
|
||||
smart_method = "multipleRequest"
|
||||
|
||||
end = len(requests)
|
||||
# The SmartCamProtocol sends requests with a length 1 as a
|
||||
# multipleRequest. The SmartProtocol doesn't so will never
|
||||
# raise_on_error
|
||||
raise_on_error = end == 1
|
||||
|
||||
multi_requests = [
|
||||
{"method": method, "params": params} if params else {"method": method}
|
||||
for method, params in requests.items()
|
||||
if method not in FORCE_SINGLE_REQUEST
|
||||
]
|
||||
|
||||
end = len(multi_requests)
|
||||
# The SmartCamProtocol sends requests with a length 1 as a
|
||||
# multipleRequest. The SmartProtocol doesn't so will never
|
||||
# raise_on_error
|
||||
raise_on_error = end == 1
|
||||
|
||||
# Break the requests down as there can be a size limit
|
||||
step = self._multi_request_batch_size
|
||||
if step == 1:
|
||||
@@ -287,7 +287,9 @@ class SmartProtocol(BaseProtocol):
|
||||
resp = await self._transport.send(
|
||||
self.get_smart_request(method, params)
|
||||
)
|
||||
self._handle_response_error_code(resp, method, raise_on_error=False)
|
||||
self._handle_response_error_code(
|
||||
resp, method, raise_on_error=raise_on_error
|
||||
)
|
||||
multi_result[method] = resp.get("result")
|
||||
return multi_result
|
||||
|
||||
|
Reference in New Issue
Block a user