Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #55 from cpainchaud/main
Browse files Browse the repository at this point in the history
SetRecV20 support
  • Loading branch information
cpainchaud authored Oct 20, 2021
2 parents 23de23b + cb9f074 commit f31e8f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions reolink/camera_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ async def map_json_response(self, json_data): # pylint: disable=too-many-branch
elif data["cmd"] == "GetRecV20":
self._recording_settings = data
self._recording_state = (
data["value"]["Rec"]["schedule"]["enable"] == 1
data["value"]["Rec"]["enable"] == 1
)
elif data["cmd"] == "GetPtzPreset":
self._ptz_presets_settings = data
Expand Down Expand Up @@ -857,10 +857,16 @@ async def set_recording(self, enable):
else:
new_value = 0

body = [
{"cmd": "SetRec", "action": 0, "param": self._recording_settings["value"]}
]
body[0]["param"]["Rec"]["schedule"]["enable"] = new_value
if self._recording_settings["value"]["Rec"].get("enable") is not None:
body = [
{"cmd": "SetRecV20", "action": 0, "param": self._recording_settings["value"]}
]
body[0]["param"]["Rec"]["enable"] = new_value
else:
body = [
{"cmd": "SetRec", "action": 0, "param": self._recording_settings["value"]}
]
body[0]["param"]["Rec"]["schedule"]["enable"] = new_value

return await self.send_setting(body)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='reolink',
packages=['reolink'],
version='0.0.33',
version='0.0.34',
license='MIT',
description='Reolink camera package',
author='fwestenberg',
Expand Down

0 comments on commit f31e8f6

Please sign in to comment.