Tuya lights don't retain state

I can control my Tuya switches by calling turn_on and turn_off services successfully, but their state can’t be retrieved from wherever the component gets it from, so they always revert to ‘off’. I’m wondering if this is a temporary problem, because they were working this morning, but this evening, I’m seeing this in my log over and over again:

2018-12-03 23:23:25 WARNING (MainThread) [homeassistant.components.switch] Updating tuya switch took longer than the scheduled update interval 0:00:30

It’s anyone else seeing this?

I’m pretty close to throwing in the towel on this one and wrapping my Tuya switches in a template switch that takes its state from an input boolean–effectively putting them in ”optimistic" mode, having them just assume the state change was successful. Perhaps that should be an option for the cloud-based switches.


walaj@JonLabNUC:/home/homeassistant/.homeassistant$ head -4 home-assistant.log
2018-11-27 14:53:04 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2018-11-27 14:53:10 ERROR (SyncWorker_9) [homeassistant.components.light.yeelight] Failed to connect to bulb, YL-FAMILY-CB1: A socket error occurred when sending the command.
2018-11-27 14:53:13 ERROR (SyncWorker_27) [homeassistant.components.light.yeelight] Failed to connect to bulb, YL-SPARE-CB2: A socket error occurred when sending the command.
2018-11-27 14:53:16 WARNING (MainThread) [homeassistant.components.light] Setup of platform yeelight is taking over 10 seconds.
walaj@JonLabNUC:/home/homeassistant/.homeassistant$ cat home-assistant.log |grep "Updating tuya switch took longer than the scheduled"|wc -l

Even with this, mine work fine - just takes a while to detect a state change

It looks like my states never update correctly. They still switch on, but then they don’t switch off correctly because HA thinks they’re already off. That’s only the “toggle” action of the switch though. Calling explicit “turn on” or “turn off” services works as expected.


Having the same trouble. They turn on no problem then the status goes back to off. I then have to restart ha to be able to turn them off and even then the status isn’t always correct.

How do you call the explicit turn off / on as you have put it?

I’m using the official tuya plugin, the tuya app works fine.


I realize I never responded to this thread, but my issue went away after a home assistant restart. Still don’t know what caused it, but it’s never happened since.

I seem to have the same issue with my Tuya integration.

It used to work rebooting the server did not solve the issue.

@mvankekeren, you seem to be one of the many affected by a recent Tuya API update. The below GitHub issues have been logged regarding this problem, which you should go comment on in order to help bring more awareness to this issue.