From 67e67213d2b2aa819659d9c15b2e83a205a073f5 Mon Sep 17 00:00:00 2001 From: joerg65 Date: Sat, 28 Nov 2020 15:39:56 +0100 Subject: [PATCH] Get pullspring duration from deviceSettings --- pytedee/pytedee/Lock.py | 12 ++++++++++++ pytedee/pytedee/TedeeClient.py | 10 +++++++--- setup.py | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pytedee/pytedee/Lock.py b/pytedee/pytedee/Lock.py index 9a0ffee..c814d5e 100644 --- a/pytedee/pytedee/Lock.py +++ b/pytedee/pytedee/Lock.py @@ -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 \ No newline at end of file diff --git a/pytedee/pytedee/TedeeClient.py b/pytedee/pytedee/TedeeClient.py index c7e4f68..7f41fc4 100644 --- a/pytedee/pytedee/TedeeClient.py +++ b/pytedee/pytedee/TedeeClient.py @@ -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''' @@ -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): diff --git a/setup.py b/setup.py index 3f992ba..4eeafb6 100644 --- a/setup.py +++ b/setup.py @@ -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="joerg.wolff@gmx.de", description="A Tedee Lock Client package",