Reduce heartbeat interval.

This commit is contained in:
ultratoto14
2020-12-15 17:12:52 +01:00
parent aeb27a4d75
commit 89dabfc105
3 changed files with 5 additions and 4 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
*~ *~
__pycache__ __pycache__
.tox .tox
tuyadebug/ tuyadebug/
.pre-commit-config.yaml

View File

@@ -150,10 +150,10 @@ class TuyaDevice(pytuya.TuyaListener, pytuya.ContextualLogger):
async def close(self): async def close(self):
"""Close connection and stop re-connect loop.""" """Close connection and stop re-connect loop."""
self._is_closing = True self._is_closing = True
if self._connect_task: if self._connect_task is not None:
self._connect_task.cancel() self._connect_task.cancel()
await self._connect_task await self._connect_task
if self._interface: if self._interface is not None:
await self._interface.close() await self._interface.close()
async def set_dp(self, state, dp_index): async def set_dp(self, state, dp_index):

View File

@@ -74,7 +74,7 @@ MESSAGE_END_FMT = ">2I" # 2*uint32: crc, suffix
PREFIX_VALUE = 0x000055AA PREFIX_VALUE = 0x000055AA
SUFFIX_VALUE = 0x0000AA55 SUFFIX_VALUE = 0x0000AA55
HEARTBEAT_INTERVAL = 20 HEARTBEAT_INTERVAL = 10
# This is intended to match requests.json payload at # This is intended to match requests.json payload at
# https://github.com/codetheweb/tuyapi : # https://github.com/codetheweb/tuyapi :