Skip to content

Commit

Permalink
Get pullspring duration from deviceSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg65 committed Nov 28, 2020
1 parent 0ae88d9 commit 67e6721
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 12 additions & 0 deletions pytedee/pytedee/Lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ def get_is_charging(self):

def set_is_charging(self, isCharging):
self._is_charging = isCharging

def set_is_enabled_pullspring(self, isEnabled):
self._is_enabled_pullspring = isEnabled

def get_is_enabled_pullspring(self):
return self._is_enabled_pullspring

def set_duration_pullspring(self, duration):
self._duration_pullspring = duration

def get_duration_pullspring(self):
return self._duration_pullspring
10 changes: 7 additions & 3 deletions pytedee/pytedee/TedeeClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ def get_devices(self):
state = x["lockProperties"]["state"]
batteryLevel = x["lockProperties"]["batteryLevel"]
isCharging = x["lockProperties"]["isCharging"]

isEnabledPullSpring =x["deviceSettings"]["pullSpringEnabled"]
durationPullSpring =x["deviceSettings"]["pullSpringDuration"]

lock = Lock(name, id)
lock.set_connected(isConnected)
lock.set_state(state)
lock.set_battery_level(batteryLevel)
lock.set_is_charging(isCharging)

lock.set_is_enabled_pullspring(isEnabledPullSpring)
lock.set_duration_pullspring(durationPullSpring)

self._lock_id = id
'''store the found lock in _sensor_list and get the battery_level'''

Expand Down Expand Up @@ -146,7 +150,7 @@ def open(self, id):
lock.set_state(2)
_LOGGER.debug("open command successful, id: %d ", id)

t = Timer(5, self.get_state)
t = Timer(lock.get_duration_pullspring() + 1, self.get_state)
t.start()

def is_unlocked(self, id):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name="pytedee", # Replace with your own username
package_dir = {'': 'pytedee'},
packages = ['pytedee'],
version="0.0.1",
version="0.0.2",
author="Jörg Wolff",
author_email="[email protected]",
description="A Tedee Lock Client package",
Expand Down

0 comments on commit 67e6721

Please sign in to comment.