diff --git a/reolink/camera_api.py b/reolink/camera_api.py index d5b1a2a..64f03a4 100644 --- a/reolink/camera_api.py +++ b/reolink/camera_api.py @@ -348,7 +348,6 @@ async def get_states(self, cmd_list=None): {"cmd": "GetEmail", "action": 1, "param": {"channel": self._channel}}, {"cmd": "GetIsp", "action": 1, "param": {"channel": self._channel}}, {"cmd": "GetIrLights", "action": 1, "param": {"channel": self._channel}}, - {"cmd": "GetRec", "action": 1, "param": {"channel": self._channel}}, {"cmd": "GetPtzPreset", "action": 1, "param": {"channel": self._channel}}, {"cmd": "GetHddInfo", "action": 1, "param": {}}, { @@ -357,11 +356,13 @@ async def get_states(self, cmd_list=None): "param": {"Alarm": {"channel": self._channel, "type": "md"}}, }, {"cmd": "GetPushV20", "action": 1, "param": {"channel": self._channel}}, + {"cmd": "GetRecV20", "action": 1, "param": {"channel": self._channel}}, ] if not self._is_nvr and self._sw_version_object < ref_sw_version_3_1_0_0_0: # NVR would crash without this body.append({"cmd": "GetPush", "action": 1, "param": {"channel": self._channel}}) + body.append({"cmd": "GetRec", "action": 1, "param": {"channel": self._channel}}) if cmd_list is not None: for x, line in enumerate(body): @@ -587,7 +588,11 @@ async def map_json_response(self, json_data): # pylint: disable=too-many-branch self._recording_state = ( data["value"]["Rec"]["schedule"]["enable"] == 1 ) - + elif data["cmd"] == "GetRecV20": + self._recording_settings = data + self._recording_state = ( + data["value"]["Rec"]["schedule"]["enable"] == 1 + ) elif data["cmd"] == "GetPtzPreset": self._ptz_presets_settings = data for preset in data["value"]["PtzPreset"]: diff --git a/reolink/exceptions.py b/reolink/exceptions.py index 0a08056..c274778 100644 --- a/reolink/exceptions.py +++ b/reolink/exceptions.py @@ -1,14 +1,19 @@ -class InvalidContentTypeError(Exception): +class ReolinkError(Exception): + pass + + +class InvalidContentTypeError(ReolinkError): """Raised when Snapshot command returns an invalid JPEG file""" pass -class SnapshotIsNotValidFileTypeError(Exception): + +class SnapshotIsNotValidFileTypeError(ReolinkError): """Raised when Snapshot command returns an invalid JPEG file""" pass -class CredentialsInvalidError(Exception): +class CredentialsInvalidError(ReolinkError): """Raised when an API call returns a credential issue""" pass diff --git a/setup.py b/setup.py index 2201a41..e3f6192 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='reolink', packages=['reolink'], - version='0.0.32', + version='0.0.33', license='MIT', description='Reolink camera package', author='fwestenberg',