From 3d0505ac41f19b009963aeb6b24f2f4e952d9f8b Mon Sep 17 00:00:00 2001 From: rospogrigio Date: Mon, 7 Sep 2020 12:07:20 +0200 Subject: [PATCH] Removed unnecessary dps from covers; reduced cache timeout for covers and lights --- custom_components/localtuya/cover.py | 4 +--- custom_components/localtuya/light.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/custom_components/localtuya/cover.py b/custom_components/localtuya/cover.py index f3a97ea..6b5d7e1 100644 --- a/custom_components/localtuya/cover.py +++ b/custom_components/localtuya/cover.py @@ -88,8 +88,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None): pytuyadevice.set_version(float(config.get(CONF_PROTOCOL_VERSION))) dps = {} dps[config.get(CONF_ID)]=None - dps["101"]=None - dps["102"]=None pytuyadevice.set_dpsUsed(dps) cover_device = TuyaCoverCache(pytuyadevice) @@ -163,7 +161,7 @@ class TuyaCoverCache: self._lock.acquire() try: now = time() - if not self._cached_status or now - self._cached_status_time > 30: + if not self._cached_status or now - self._cached_status_time > 15: sleep(0.5) self._cached_status = self.__get_status() self._cached_status_time = time() diff --git a/custom_components/localtuya/light.py b/custom_components/localtuya/light.py index 1193eb6..464d5f1 100644 --- a/custom_components/localtuya/light.py +++ b/custom_components/localtuya/light.py @@ -124,7 +124,7 @@ class TuyaCache: self._lock.acquire() try: now = time() - if not self._cached_status or now - self._cached_status_time > 30: + if not self._cached_status or now - self._cached_status_time > 15: sleep(0.5) self._cached_status = self.__get_status(switchid) self._cached_status_time = time()