For a few weeks none of my Tuya devices are updating their current state properly in the Lovelace interface. If one is showing on and is actually on and I turn it off, the device will turn off but after a second or so, the interface will show that it is on again even though it’s not.
Restarting HA resolves the problem until a device changes state again.
My non-Tuya devices are not having this issue.
This started happening right around the time of the 2021.12 release, but I suspect it may be a problem with Tuya as was the case in 2019 (from what I’ve been able to gather).
Is anyone else experiencing this behavior or know what is causing it? Does anyone have a fix?
Thanks for the reply. Not sure why I didn’t find those threads before, but I did read through them. Interestingly, I saw one reply saying logging into the Tuya IoT dashboard solved the problem, so I logged in and restarted HA. Everything started working normally again. I’ll keep an eye on it for the next few days.
A work around that has been working for me is to create a node-red flow to reload the config entry. I have this executing every 30 minutes. Don’t forget to add the tuya entities.
I have the same behaviour on my devices. Instead of rebooting Home Assistant, just reload the Tuya integration and it recovers the actual states. But if I actuate any device again, it will turn it ON or OFF and 1 second later the switch goes to the old state.
On Tuya “v1” I never had this issue and I’m using the same devices.
I have the same problem, but found a workaround: Disable IPv6 in Supervisor → Host → Ip-Adress .
When setting the logger for tuya/tuya_iot to DEBUG you will notice, that there is often missing the PUBLISH answer from tuya after a POST of the switch-command. When IPv6 is disabled this happens nearly never.
Update: Sorry, disabling IPv6 seems to be not reliable. It was okay when I first configured it but later in the day I noticed that HomeAssistant was not showing the true state. Reloading Tuya integration corrects the states, but then it is is not permanent.
Previous comment:
Disabling IPv6 was the fix for me too! Kudos @Peter_Junker !
For those who use container (with docker compose) like me, I just disabled the IPv6 of the host device (Pi, method 2 here) then reboot it. External state updates are now instantly displayed on homeassistant.
As most people I also tried disabling ipv6. I think I wrote in some thread that this solved some my problem but it didnt. I’m not professional sysadmin nor programmer so I can’t elaborate on that matter from networking point of view, but in my experience this doesnt solve any problems.
I forgot what problems I tried to solved, I think it was some dns issue, but the problem wasnt ipv6. It was my dns miss configuration.
I like to share my fix or workaround for this issue.
Im not shure if i have granted the API Permissions correctly when i have setup the integration.
After i added the “Data Dashbord Service” on the “Service API” site of Tuya, the switch states are allways in the correct state.
When i created the Project in the Tuya Development Environment i accidentally selected Development Type “Custom” instead of “Smart Home”.
Unfortunately you can’t change that after you created the Project so you need to create a whole new Project and make sure to set the Development Type to Smart Home.