From 058380f2be7e9173a04b6ea647b0b13cc99fbcd8 Mon Sep 17 00:00:00 2001 From: Steve Briskin Date: Thu, 23 Jan 2025 01:52:28 -0500 Subject: [PATCH 1/2] feature: add get zoom/focus, discrete set zoom/focus commands, and get/set autofocus (#89) * zoom and focus commands * get and set autofocus * fix SetAutoFocus api call * update readme --- README.md | 5 +++-- reolinkapi/mixins/zoom.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 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 diff --git a/reolinkapi/mixins/zoom.py b/reolinkapi/mixins/zoom.py index 0f5778d..74549e0 100644 --- a/reolinkapi/mixins/zoom.py +++ b/reolinkapi/mixins/zoom.py @@ -16,6 +16,31 @@ 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 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": {"AutoFocus": {"channel": 0, "disable": 1 if disable else 0}}}] + 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 e0fee8d9d31428791ff447a59f6fdf9d1e7d0682 Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Thu, 23 Jan 2025 07:57:39 +0100 Subject: [PATCH 2/2] release: version 0.4.1 (#90) Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> --- reolinkapi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reolinkapi/__init__.py b/reolinkapi/__init__.py index 28945de..ce35f76 100644 --- a/reolinkapi/__init__.py +++ b/reolinkapi/__init__.py @@ -1,4 +1,4 @@ from reolinkapi.handlers.api_handler import APIHandler from .camera import Camera -__version__ = "0.4.0" +__version__ = "0.4.1" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy