From 7b3dde9aa0b2580c5b4a77e5934f6c9377c44443 Mon Sep 17 00:00:00 2001 From: "Steven B." <51370195+sdb9696@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:11:43 +0000 Subject: [PATCH] Raise errors on single smartcam child requests (#1427) --- kasa/protocols/smartcamprotocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kasa/protocols/smartcamprotocol.py b/kasa/protocols/smartcamprotocol.py index a1d6ae9c..9bf40f7d 100644 --- a/kasa/protocols/smartcamprotocol.py +++ b/kasa/protocols/smartcamprotocol.py @@ -244,11 +244,15 @@ class _ChildCameraProtocolWrapper(SmartProtocol): responses = response["multipleRequest"]["responses"] response_dict = {} + + # Raise errors for single calls + raise_on_error = len(requests) == 1 + for index_id, response in enumerate(responses): response_data = response["result"]["response_data"] method = methods[index_id] self._handle_response_error_code( - response_data, method, raise_on_error=False + response_data, method, raise_on_error=raise_on_error ) response_dict[method] = response_data.get("result")