Tuya devices state not updating properly

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!
Paul

This is a recurring problem:

#731
#733
#740

home-assistant/core#59643
home-assistant/core#59689
home-assistant/core#59872
home-assistant/core#59874
home-assistant/core#59911
home-assistant/core#61820

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.

1 Like

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.

2 Likes

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.

1 Like

Mine was working perfectly for months. The problem started for me right around the time the 2021.12 update was installed.

1 Like

They seem to have fixed it. Working good for me too

Still wasn’t working - I reverted to 2021.05.

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.

4 Likes

This definatley fixes the problem, state changes are instant now.

2 Likes

Disabling IPV6 works for me too! Thanks

I had the same problem with tuya smart switches. My solution to this problem is explained in my post

https://community.home-assistant.io/t/local-tuya-help/370427/12?u=dadopq

For now this is working. I’m testing things out but for now there is no problem. If anyone is willing to test this on his setup, please do.

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.

Dont disable ipv6 . In my experience it wont solve any problems but it will generate a lot of problems. This isnt way for solving problems.

agree! it´s only a temp workaround.

For me, it still works.

can you elaborate, what problems? what used IPv6 over IPv4?

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.

1 Like

I’d like to share my solution to the problem.

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.

This is wrong:

This is correct:

3 Likes

This worked for me. Thanks! :grinning: