From 01f03dbb985e42de0083ef4e8af0390d301452dd Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Thu, 8 Aug 2024 19:11:48 +0200 Subject: [PATCH] Add Set_favorite_position and Go_favorite_position --- README.md | 4 ++++ motionblinds/motion_blinds.py | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/README.md b/README.md index db19058..c15f291 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,8 @@ A blind device (that was asigned to variable 'blind_1') has the following method | "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind | | "blind_1.Jog_up()" | - | - | Open the blind/move the blind one step up | | "blind_1.Jog_down()" | - | - | Close the blind/move the blind one step down | +| "blind_1.Go_favorite_position()" | - | - | Move the blind to the favorite position | +| "blind_1.Set_favorite_position()" | - | - | Set current position as favorite position, first you need to put the blind in configuration mode by pressing the reset button shortly | | "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind | | "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id | | "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind | @@ -279,6 +281,8 @@ The TDBU device (that was asigned to variable 'blind_1') has the following metho | "blind_1.Set_angle(90, motor = 'B')" | angle, motor | int (0-180), 'B', 'T' or 'C' | Set the angle/rotation of the Bottom or Top motor of the blind | | "blind_1.Jog_up(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step up | | "blind_1.Jog_down(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step down | +| "blind_1.Go_favorite_position()" | - | - | Move the blind to the favorite position | +| "blind_1.Set_favorite_position()" | - | - | Set current position as favorite position, first you need to put the blind in configuration mode by pressing the reset button shortly | | "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind | | "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id | | "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind | diff --git a/motionblinds/motion_blinds.py b/motionblinds/motion_blinds.py index ddb36f2..3de72a1 100644 --- a/motionblinds/motion_blinds.py +++ b/motionblinds/motion_blinds.py @@ -1413,6 +1413,27 @@ def Jog_down(self): self._parse_response(response) + def Set_favorite_position(self): + """ + Set current position as favorite position. + + First the blind needs to be put in configuration mode (stepping up/down). + This is done by shortly pressing the reset button on the physical device. + """ + data = {"operation": 11} + + response = self._write(data) + + self._parse_response(response) + + def Go_favorite_position(self): + """Move the blind to the favorite position.""" + data = {"operation": 12} + + response = self._write(data) + + self._parse_response(response) + def Register_callback(self, cb_id, callback): """Register a external callback function for updates of this blind.""" if cb_id in self._registered_callbacks: @@ -1904,6 +1925,27 @@ def Jog_down(self, motor: str = "B"): self._parse_response(response) + def Set_favorite_position(self): + """ + Set current position as favorite position. + + First the blind needs to be put in configuration mode (stepping up/down). + This is done by shortly pressing the reset button on the physical device. + """ + data = {"operation_B": 11, "operation_T": 11} + + response = self._write(data) + + self._parse_response(response) + + def Go_favorite_position(self): + """Move the blind to the favorite position.""" + data = {"operation_B": 12, "operation_T": 12} + + response = self._write(data) + + self._parse_response(response) + @property def scaled_position(self): """