Skip to content

Commit

Permalink
move available logic to library
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG committed Dec 6, 2020
1 parent 55700f5 commit 16fe57e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
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.5"
__version__ = "0.4.6"

# Import motion_blinds module
from .motion_blinds import MotionGateway
Expand Down
14 changes: 12 additions & 2 deletions motionblinds/motion_blinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,12 @@ def GetDeviceList(self):
"""Get the device list from the Motion Gateway."""
msg = {"msgType":"GetDeviceList", "msgID":self._get_timestamp()}

response = self._send(msg)
try:
response = self._send(msg)
except socket.timeout:
for blind in self.device_list.values():
blind._available = False
raise

# check msgType
msgType = response.get("msgType")
Expand All @@ -489,7 +494,12 @@ def Update(self):

msg = {"msgType":"ReadDevice", "mac": self.mac, "deviceType": self.device_type, "msgID":self._get_timestamp()}

response = self._send(msg)
try:
response = self._send(msg)
except socket.timeout:
for blind in self.device_list.values():
blind._available = False
raise

# check msgType
msgType = response.get("msgType")
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.5',
version='0.4.6',
description='Python library for interfacing with Motion Blinds',
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 16fe57e

Please sign in to comment.