iRayanKhan / homebridge-tuya

A Homebridge plugin to control Tuya devices locally.
MIT License
394 stars 164 forks source link

Devices not caching? Re-detected every restart #323

Closed HenryPz closed 3 years ago

HenryPz commented 3 years ago

Hi, Love the plugin! I have my tuya devices working locally!

I however am having an issue where my devices are not cached and re-detected/removed and re-added upon every restart of homebridge. This leads to the devices disappearing and reappearing in homekit, breaking any automations and resetting the device customizations such as room selected.

To Reproduce Setup device automations using tuya detected devices. Restart homebridge. Devices are removed and re-added to homekit, breaking automations as the devices are detected as a new.

Expected behavior Devices are cached and not re-detected upon homebridge restart/Not removed from homekit until detected within plugin.

Logs [9/12/2021, 11:24:40 AM] [homebridge-tuya.TuyaLan] Discovered Porch Lights (xxxID) identified as SimpleDimmer (3.3) [Tuya] Changing ping gap for Porch Lights to 9s [9/12/2021, 11:24:40 AM] The plugin 'homebridge-tuya-lan' registered a new accessory for the platform 'TuyaLan'. The platform couldn't be found though! [Tuya DEBUG] reconnect called for Porch Lights [9/12/2021, 11:24:40 AM] [homebridge-tuya.TuyaLan] Connected to Porch Lights [Tuya] Sending first query to Porch Lights (3.3) [Tuya] Heard back from Porch Lights with command 10 [9/12/2021, 11:24:40 AM] [homebridge-tuya.TuyaLan] Ready to handle Porch Lights (SimpleDimmer:3.3) with signature {"1":false,"2":57,"3":10,"4":"halogen"} [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Discovered Bay Window (xxxID) identified as SimpleDimmer (3.3) [Tuya] Changing ping gap for Bay Window to 9s [9/12/2021, 11:24:43 AM] The plugin 'homebridge-tuya-lan' registered a new accessory for the platform 'TuyaLan'. The platform couldn't be found though! [Tuya DEBUG] reconnect called for Bay Window [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Connected to Bay Window [Tuya] Sending first query to Bay Window (3.3) [Tuya] Heard back from Bay Window with command 10 [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Ready to handle Bay Window (SimpleDimmer:3.3) with signature {"1":false,"2":25,"3":10,"4":"LED"} [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Discovered Ceiling Fan (xxxID) identified as Fanlight (3.3) [Tuya] Changing ping gap for Ceiling Fan to 9s [9/12/2021, 11:24:43 AM] The plugin 'homebridge-tuya-lan' registered a new accessory for the platform 'TuyaLan'. The platform couldn't be found though! [Tuya DEBUG] reconnect called for Ceiling Fan [Tuya] Discovery ended. [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Connected to Ceiling Fan [Tuya] Sending first query to Ceiling Fan (3.3) [Tuya] Heard back from Ceiling Fan with command 10 [9/12/2021, 11:24:43 AM] [homebridge-tuya.TuyaLan] Ready to handle Ceiling Fan (Fanlight:3.3) with signature {"1":true,"3":"2","9":true,"10":100,"101":0,"103":0,"105":10,"106":"mode1"} [Tuya DEBUG] decrementing this._connectionAttempts, currently 2 [Tuya DEBUG] decrementing this._connectionAttempts, currently 1 [Tuya DEBUG] decrementing this._connectionAttempts, currently 2 [Tuya DEBUG] decrementing this._connectionAttempts, currently 1 [Tuya DEBUG] decrementing this._connectionAttempts, currently 2 [Tuya DEBUG] decrementing this._connectionAttempts, currently 1

Homebridge Config { "platform": "homebridge-tuya.TuyaLan", "devices": [ { "name": "Porch Lights", "type": "SimpleDimmer", "manufacturer": "Light", "model": "DS01C", "id": "xxx", "key": "xxx" }, { "name": "Bay Window", "type": "SimpleDimmer", "manufacturer": "Light", "model": "DS01C", "id": "xxx", "key": "xxx" }, { "name": "Ceiling Fan", "type": "Fanlight", "manufacturer": "Light", "model": "DS03", "id": "xxx", "key": "xxx", "dpActive": 1, "dpRotationSpeed": 3, "dpLightOn": 9, "dpBrightness": 10 } ] },

Environment (please complete the following information): Latest Onzu homebridge docker. https://github.com/oznu/docker-homebridge

HenryPz commented 3 years ago

I believe this was due to having homebridge-tuya-lan and homebridge-tuya installed at the same time. Causing various issues.