* Fix reconnect failure for some error cases
* Bump tuyapi version to latest
This commit is contained in:
tsightler
2021-01-27 13:46:55 -05:00
parent 02d5124b62
commit 8b532d9df1
3 changed files with 8 additions and 10 deletions

View File

@@ -601,9 +601,7 @@ class TuyaDevice {
this.reconnecting = true
debugError('Error connecting to device id '+this.options.id+'...retry in 10 seconds.')
await utils.sleep(10)
if (!this.device.isConnected) {
this.connectDevice()
}
this.connectDevice()
this.reconnecting = false
}
}
@@ -626,7 +624,7 @@ class TuyaDevice {
await utils.sleep(1)
this.connectDevice()
} else if (this.heartbeatsMissed > 0) {
const errMessage = this.heartbeatsMissed > 1 ? " consecutive heartbeats" : " heartbeat"
const errMessage = this.heartbeatsMissed > 1 ? " heartbeats" : " heartbeat"
debugError('Device id '+this.options.id+' has missed '+this.heartbeatsMissed+errMessage)
}
this.heartbeatsMissed++

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "tuya-mqtt",
"version": "3.0.3",
"version": "3.0.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2302,9 +2302,9 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"tuyapi": {
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/tuyapi/-/tuyapi-6.1.3.tgz",
"integrity": "sha512-/7nI3Dr3NwWMDnrz7MSRQw9lW3R5i6lnRStIjPgybZ1Wj1jL/PHuRfeNBPAb8ocNbLQN6JqxbefY4awXmp+LqQ==",
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/tuyapi/-/tuyapi-6.1.4.tgz",
"integrity": "sha512-aE1ctVaF1fXUbwMatQvr6GuE1kmVD0QdIIm/9AUJW+mOCOg5SSt2XyTmKc8qirJ6iQ3lZcTnHp9xK6gRAzrOLA==",
"requires": {
"debug": "4.1.1",
"p-queue": "6.6.1",

View File

@@ -1,6 +1,6 @@
{
"name": "tuya-mqtt",
"version": "3.0.3",
"version": "3.0.4",
"description": "Control Tuya devices locally via MQTT",
"homepage": "https://github.com/TheAgentK/tuya-mqtt#readme",
"main": "tuya-mqtt.js",
@@ -19,7 +19,7 @@
"json5": "^2.1.3",
"mqtt": "^4.2.6",
"supports-color": "^8.1.0",
"tuyapi": "^6.1.3",
"tuyapi": "^6.1.4",
"mathjs": "8.1.1"
},
"repository": {