Skip to content

Commit

Permalink
Use Baichuan fallback for send_setting
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG committed Nov 21, 2024
1 parent c55b97a commit a2afe08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reolink_aio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5142,7 +5142,7 @@ async def send_setting(self, body: typings.reolink_json, wait_before_get: int =
_LOGGER.debug("Response from cmd '%s' from %s:%s: %s", command, self._host, self._port, json_data)

try:
if json_data[0]["code"] != 0 or json_data[0].get("value", {}).get("rspCode", -1) != 200:
if (json_data[0]["code"] != 0 or json_data[0].get("value", {}).get("rspCode", -1) != 200) and not json_data[0].get("Baichuan_fallback_succes", False):
_LOGGER.debug("ApiError for command '%s', response: %s", command, json_data)
rspCode = json_data[0].get("value", json_data[0]["error"])["rspCode"]
detail = json_data[0].get("value", json_data[0]["error"]).get("detail", "")
Expand Down Expand Up @@ -5486,8 +5486,10 @@ async def send_chunk(
await func(**args)
except ReolinkError as err:
_LOGGER.debug("Baichuan fallback failed for %s: %s", cmd.get("cmd"), str(err))
json_data[idx]["Baichuan_fallback_succes"] = False
else:
_LOGGER.debug("Baichuan fallback succeeded for %s", cmd.get("cmd"))
json_data[idx]["Baichuan_fallback_succes"] = True
continue
# add to the list of cmds to retry
retry_cmd.append(cmd)
Expand Down

0 comments on commit a2afe08

Please sign in to comment.