tuya-local icon indicating copy to clipboard operation
tuya-local copied to clipboard

Garage door becoming unavailable if it was opened not by HAAS

Open myevit opened this issue 3 years ago • 2 comments

If I use real button or original cloud tuya app to open garage door, integration is loosing connection to device (and HAAS never trigger the automations). Also it takes long time (>10 sec) to report state of the door if triggered by intergation therefore it delaying the automations.

2021-12-06 20:24:10 INFO (SyncWorker_6) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.1.
2021-12-06 20:24:23 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Refreshing device state for Garage Door.
2021-12-06 20:24:23 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Retrying after exception 'dps'
2021-12-06 20:24:23 INFO (SyncWorker_1) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.3.
2021-12-06 20:24:24 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Retrying after exception 'dps'
2021-12-06 20:24:24 INFO (SyncWorker_1) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.1.
2021-12-06 20:24:24 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Retrying after exception 'dps'
2021-12-06 20:24:24 INFO (SyncWorker_1) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.3.
2021-12-06 20:24:25 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Retrying after exception 'dps'
2021-12-06 20:24:25 ERROR (SyncWorker_1) [custom_components.tuya_local.device] Failed to refresh device state for Garage Door.
2021-12-06 20:24:25 INFO (SyncWorker_1) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.1.
2021-12-06 20:24:38 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] Refreshing device state for Garage Door.
2021-12-06 20:24:48 WARNING (MainThread) [homeassistant.helpers.entity] Update of cover.garage_door is taking over 10 seconds
2021-12-06 20:24:53 WARNING (MainThread) [homeassistant.components.cover] Updating tuya_local cover took longer than the scheduled update interval 0:00:15
2021-12-06 20:25:08 WARNING (MainThread) [homeassistant.components.cover] Updating tuya_local cover took longer than the scheduled update interval 0:00:15
2021-12-06 20:25:08 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] Retrying after exception 'dps'
2021-12-06 20:25:08 INFO (SyncWorker_5) [custom_components.tuya_local.device] Setting protocol version for Garage Door to 3.3.
2021-12-06 20:25:08 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] Garage Door refreshed device state: {"devId": "xxxx", "dps": {"1": false, "7": 0, "101": false, "102": false, "updated_at": 1638847508.707621}}
2021-12-06 20:25:08 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] new cache state (including pending properties): {"1": false, "7": 0, "101": false, "102": false, "updated_at": 1638847508.707621}
2021-12-06 20:25:38 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Refreshing device state for Garage Door.
2021-12-06 20:25:38 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] Garage Door refreshed device state: {"devId": "xxxx", "dps": {"1": false, "7": 0, "101": false, "102": false, "updated_at": 1638847538.1481922}}
2021-12-06 20:25:38 DEBUG (SyncWorker_1) [custom_components.tuya_local.device] new cache state (including pending properties): {"1": false, "7": 0, "101": false, "102": false, "updated_at": 1638847538.1481922}

myevit avatar Dec 07 '21 03:12 myevit

If you use the tuya app when your phone is connected to the local wifi, then it is likely that it will make a local connection to the device, and as most Tuya devices seem to be limited to a single local connection, it will block this integration from connecting until the app is closed.

In the case of a hardware button though, I am not sure why this would happen unless this particular device uses WiFi to connect the button to the opening mechanism. Perhaps there is also something internal in the device that if it is operating the motors it closes its network connection due to memory/CPU power constraints, or just to avoid having to deal with commands part way through an open/close operation to simplify the logic.

I don't think this is a bug in the integration or we would see it on more devices, however there is a possibility that what we are sending crashes the device (though if it is otherwise responding to commands correctly, that shouldn't be the case).

make-all avatar Jul 18 '22 05:07 make-all

The >10 second is due to using local polling to detect device state, and combined with the limitations observed with Tuya devices it doesn't seem reliable to poll any faster than that.

make-all avatar Jul 18 '22 05:07 make-all

There are a couple of recent changes that may improve this.

  1. the change in 2022.12.0 to keep old values when the device reports only partial dps.
  2. the change in 2022.12.1 to allow specifying the protocol explicitly - if you try the different protocol versions, you may find one that works better than the default of "auto".

make-all avatar Dec 22 '22 01:12 make-all

The upcoming change in 2023.1.1 to use persistent connections will likely help as well.

make-all avatar Jan 11 '23 16:01 make-all