Skip to content

Commit

Permalink
Add Update_trigger command
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG committed Mar 31, 2021
1 parent 4f411fe commit 0d51d46
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,19 @@ A gateway device (that was asigned to variable 'm') has the following methods an
## Blind device
A blind device (that was asigned to variable 'blind_1') has the following methods and properties:

| method | arguments | argument type | explanation |
| ------------------------------------- | ------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| "blind_1.Update_from_cache()" | - | - | Get the status of the blind from the cache of the Motion Gateway, No 433MHz radio communication with the blind takes place |
| "blind_1.Update()" | - | - | Get the status of the blind from the blind through the Motion Gateway (WiFi) using 433MHz radio communication between the gateway and the blind |
| "blind_1.Stop()" | - | - | Stop the motion of the blind |
| "blind_1.Open()" | - | - | Open the blind/move the blind up |
| "blind_1.Close()" | - | - | Close the blind/move the blind down |
| "blind_1.Set_position(50)" | postion | int (0-100) | Set the position of the blind |
| "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind |
| "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 |
| method | arguments | argument type | explanation |
| ------------------------------------- | ------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "blind_1.Update_from_cache()" | - | - | Get the status of the blind from the cache of the Motion Gateway, No 433MHz radio communication with the blind takes place |
| "blind_1.Update_trigger()" | - | - | Get the status of the blind from the cache of the Motion Gateway and request a 433MHz radio communication with the blind for a new status (not awaited) |
| "blind_1.Update()" | - | - | Get the status of the blind from the blind through the Motion Gateway (WiFi) using 433MHz radio communication between the gateway and the blind |
| "blind_1.Stop()" | - | - | Stop the motion of the blind |
| "blind_1.Open()" | - | - | Open the blind/move the blind up |
| "blind_1.Close()" | - | - | Close the blind/move the blind down |
| "blind_1.Set_position(50)" | postion | int (0-100) | Set the position of the blind |
| "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind |
| "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 |

| property | value type | explanation |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion motionblinds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logging.getLogger(__name__)

__title__ = "motion-blinds"
__version__ = "0.4.10"
__version__ = "0.4.11"

# Import motion_blinds module
from .motion_blinds import MotionGateway
Expand Down
18 changes: 14 additions & 4 deletions motionblinds/motion_blinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,19 @@ def Update_from_cache(self):

self._parse_response(response)

def Update_trigger(self):
"""
Get the status of the blind from the cache of the Motion Gateway and request a new status from the blind
This will send a query to the blind to retrieve its status, but does not wait for that new status.
The Gateway will imediatly respond with the status of the blind from cache (old status), this status is processed.
The multicast push response of the blind over 433MHz radio is not awaited.
"""
response = self._write(self.QUERY_DATA)

# parse status from cache
self._parse_response(response)

def Update(self):
"""
Get the status of the blind from the blind through the Motion Gateway
Expand All @@ -848,10 +861,7 @@ def Update(self):
start = datetime.datetime.utcnow()

# send update request
response = self._write(self.QUERY_DATA)

# parse status from cache
self._parse_response(response)
self.Update_trigger()

# wait on multicast push for new status
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
README = (HERE / "README.md").read_text()

setup(name='motionblinds',
version='0.4.10',
version='0.4.11',
description='Python library for interfacing with Motion Blinds',
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0d51d46

Please sign in to comment.