Skip to content

Commit

Permalink
Add Set_favorite_position and Go_favorite_position
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG committed Aug 8, 2024
1 parent 4a68e2d commit 01f03db
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down
42 changes: 42 additions & 0 deletions motionblinds/motion_blinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 01f03db

Please sign in to comment.