Skip to content

Commit c6ce40e

Browse files
committed
Fix time range for Post recording when relaying on Baichuan
1 parent 633b4cf commit c6ce40e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

reolink_aio/baichuan/baichuan.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
}
9696

9797
TIME_STR_TO_INT_SEC = {
98+
"8 Seconds": 8,
9899
"15 Seconds": 15,
99100
"30 Seconds": 30,
100101
"1 Minute": 60,
@@ -3199,10 +3200,20 @@ async def GetRec(self, channel: int, **_kwargs) -> None:
31993200

32003201
mess = await self.send(cmd_id=54, channel=channel)
32013202
data = get_keys_from_xml(mess, {"recordDelayTime": ("postRec_int", int), "packageTime": ("packTime_int", int)})
3202-
data["postRec"] = TIME_INT_SEC_TO_STR.get(data.get("postRec_int", 0))
3203-
data["packTime"] = TIME_INT_SEC_TO_STR.get(data.get("packTime_int", 0) * 60)
3203+
data["postRec"] = TIME_INT_SEC_TO_STR.get(data.get("postRec_int", 0), "")
3204+
data["packTime"] = TIME_INT_SEC_TO_STR.get(data.get("packTime_int", 0) * 60, "")
32043205
rec_set.update(data)
32053206

3207+
root = XML.fromstring(mess)
3208+
time_range = []
3209+
for time in root.findall(".//timeList/time"):
3210+
val = time.text
3211+
if val is None:
3212+
continue
3213+
time_range.append(TIME_INT_SEC_TO_STR.get(int(val), ""))
3214+
if time_range:
3215+
self.http_api._recording_range.setdefault(channel, {})["postRec"] = time_range
3216+
32063217
@http_cmd(["SetRecV20", "SetRec"])
32073218
async def SetRecV20(self, **kwargs) -> None:
32083219
"""Set the recoding info"""

0 commit comments

Comments
 (0)