From b4d3c0ea0edbc36573901ee4ed18dae6e08ca0c0 Mon Sep 17 00:00:00 2001 From: Steve Briskin Date: Mon, 30 Dec 2024 17:25:52 -0500 Subject: [PATCH 1/4] zoom and focus commands --- reolinkapi/mixins/zoom.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/reolinkapi/mixins/zoom.py b/reolinkapi/mixins/zoom.py index 0f5778d..b321d6a 100644 --- a/reolinkapi/mixins/zoom.py +++ b/reolinkapi/mixins/zoom.py @@ -16,6 +16,21 @@ def _stop_zooming_or_focusing(self) -> Dict: data = [{"cmd": "PtzCtrl", "action": 0, "param": {"channel": 0, "op": "Stop"}}] return self._execute_command('PtzCtrl', data) + def get_zoom_focus(self) -> Dict: + """This command returns the current zoom and focus values.""" + data = [{"cmd": "GetZoomFocus", "action": 0, "param": {"channel": 0}}] + return self._execute_command('GetZoomFocus', data) + + def start_zoom_pos(self, position: float) -> Dict: + """This command sets the zoom position.""" + data = [{"cmd": "StartZoomFocus", "action": 0, "param": {"ZoomFocus": {"channel": 0, "op": "ZoomPos", "pos": position}}}] + return self._execute_command('StartZoomFocus', data) + + def start_focus_pos(self, position: float) -> Dict: + """This command sets the focus position.""" + data = [{"cmd": "StartZoomFocus", "action": 0, "param": {"ZoomFocus": {"channel": 0, "op": "FocusPos", "pos": position}}}] + return self._execute_command('StartZoomFocus', data) + def start_zooming_in(self, speed: float = 60) -> Dict: """ The camera zooms in until self.stop_zooming() is called. From 29096392fa73a9031f2d8a08012995fff1f0d3a6 Mon Sep 17 00:00:00 2001 From: Steve Briskin Date: Mon, 30 Dec 2024 17:32:33 -0500 Subject: [PATCH 2/4] get and set autofocus --- reolinkapi/mixins/zoom.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reolinkapi/mixins/zoom.py b/reolinkapi/mixins/zoom.py index b321d6a..7d7d2d8 100644 --- a/reolinkapi/mixins/zoom.py +++ b/reolinkapi/mixins/zoom.py @@ -31,6 +31,16 @@ def start_focus_pos(self, position: float) -> Dict: data = [{"cmd": "StartZoomFocus", "action": 0, "param": {"ZoomFocus": {"channel": 0, "op": "FocusPos", "pos": position}}}] return self._execute_command('StartZoomFocus', data) + def get_auto_focus(self) -> Dict: + """This command returns the current auto focus status.""" + data = [{"cmd": "GetAutoFocus", "action": 0, "param": {"channel": 0}}] + return self._execute_command('GetAutoFocus', data) + + def set_auto_focus(self, disable: bool) -> Dict: + """This command sets the auto focus status.""" + data = [{"cmd": "SetAutoFocus", "action": 0, "param": {"channel": 0, "disable": disable}}] + return self._execute_command('SetAutoFocus', data) + def start_zooming_in(self, speed: float = 60) -> Dict: """ The camera zooms in until self.stop_zooming() is called. From f2006fa1ddaba5c2ac35ea572e3abcc87459b0af Mon Sep 17 00:00:00 2001 From: Steve Briskin Date: Thu, 2 Jan 2025 10:11:33 -0500 Subject: [PATCH 3/4] fix SetAutoFocus api call --- reolinkapi/mixins/zoom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reolinkapi/mixins/zoom.py b/reolinkapi/mixins/zoom.py index 7d7d2d8..74549e0 100644 --- a/reolinkapi/mixins/zoom.py +++ b/reolinkapi/mixins/zoom.py @@ -38,7 +38,7 @@ def get_auto_focus(self) -> Dict: def set_auto_focus(self, disable: bool) -> Dict: """This command sets the auto focus status.""" - data = [{"cmd": "SetAutoFocus", "action": 0, "param": {"channel": 0, "disable": disable}}] + data = [{"cmd": "SetAutoFocus", "action": 0, "param": {"AutoFocus": {"channel": 0, "disable": 1 if disable else 0}}}] return self._execute_command('SetAutoFocus', data) def start_zooming_in(self, speed: float = 60) -> Dict: From 5aec5a5befedf7c12412716006093ee94460e0bd Mon Sep 17 00:00:00 2001 From: Steve Briskin Date: Thu, 2 Jan 2025 10:14:46 -0500 Subject: [PATCH 4/4] update readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b9c651..87a205f 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ GET: - [X] User -> Manage User - [X] Device -> HDD/SD Card - [x] PTZ -> Presets, Calibration Status -- [ ] Zoom -- [ ] Focus +- [x] Zoom +- [x] Focus - [ ] Image (Brightness, Contrast, Saturation, Hue, Sharp, Mirror, Rotate) - [ ] Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, LED light, 3D-NR) - [X] Image Data -> "Snap" Frame from Video Stream @@ -152,6 +152,7 @@ do not work and is not supported here. - RLC-410-5MP - RLC-510A - RLC-520 +- RLC-823A - C1-Pro - D400 - E1 Zoom