core: Tuya devices are slow to react - no changes to HA

The problem

A day or two ago my few Tuya devices (4-5 dimmers) started acting up. They mostly react to commands from HA (on/off/brightness) but the Lovlace rockers/buttons do not follow - turning on a light will flip the rocker, then it will return to off and most of the time (not always) it will return to on after some 30 seconds. Sometimes the rockers will never detect actual light status and thereby go “stuck” with no way of turning on or off a light that is already in the other state. Brightness sometimes work and sometimes not at all.

Operating directly on the dimmers work perfectly as do using the Tuya dedicated app.

I was on core-2021.10.5 and tried to remedy the problem late last night by upgrading to core-2021.11.4 and OS 6.6 but the behaviour was exactly the same.

My take is that there is something wrong with the Tuya cloud/API side of things.

Video (I press the ‘Guest room’ rocker at the bottom ONCE): Video Link on Vimeo Post on community.home-assistant.io: Link

What version of Home Assistant Core has the issue?

core-2021.11.4

What was the last working version of Home Assistant Core?

core-2021.10.5 (but started failing suddenly some 1-2 days ago)

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya (new)

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Found nothing.

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 18
  • Comments: 51 (8 by maintainers)

Most upvoted comments

Have the same exact problem, in fact had to turn off various automations due to lack of reliability with this integration (was working flawlessly a week or so ago regardless of the HA version).

This also seems to be related with various other issues reporting similar behaviour:

It doesn’t seem to be related with Iot tuya cloud as debugging each device comes back with accurate data, seems to be more of an integration issue.

Hope they fix this soon.

Finally got this response from Tuya Support when asking them to escalate the issue:

we will verify your question with the HA official. Thank you for your feedback. We will update you as soon as possible

Another option would be to use the old Tuya custom component. It worked well for me for a long time. I will switch back to it and try later today. https://community.home-assistant.io/t/use-old-tuya-integration-as-custom-component-until-v2-is-on-par/345999

A quick test a few minutes ago: Looks like it’s working now. Will monitor the coming days.

I’ve been perusing the code. When Tuya initialises ( or when you do a “reload” under integrations for Tuya ), all current device states are pulled ( polled ) by the Tuya device manager. But this is a one time deal for this integration. Thereafter, looks like a listener is setup, to listen for device updates :

__init__.py

tuya_mq = TuyaOpenMQ(api) tuya_mq.start() device_ids: set[str] = set() device_manager = TuyaDeviceManager(api, tuya_mq) home_manager = TuyaHomeManager(api, tuya_mq, device_manager) listener = DeviceListener(hass, device_manager, device_ids) device_manager.add_device_listener(listener)

Thereafter, if you change the state of your device OR if the state of your device changes in the case of sensors etc… HA is fully dependant on Tuya notifications on this listener ( this is why you have to authorise the Device Status Notification API service for your cloud project ) :

def update_device(self, device: TuyaDevice) -> None: """Update device status.""" if device.id in self.device_ids: _LOGGER.debug( "Received update for device %s: %s", device.id, self.device_manager.device_map[device.id].status, ) dispatcher_send(self.hass, f"{TUYA_HA_SIGNAL_UPDATE_ENTITY}_{device.id}")

Sorry for the bad markup, but you get the idea.

Hard to know if the Smartlife / TuyaSmart Apps are doing the same thing…I would guess they are not, and probably polling an update status on the user initiated update request OR simply accepting the state of the device based on the 200OK response.

Ultimately, I can’t see Tuya just letting he HA community have at it on API polling, so the listener gives them more control on the traffic rate as they push to us, and they can control how often, and how much.

The LocalTuya integration also has no such issues, I use that for most of my devices but it doesn’t support HVAC at the moment so currently need the official integration for that single device.

Just got that setup with the aid of https://www.youtube.com/watch?v=vq2L9c5hDfQ and yes it seems to work really fast.

Same issues here. Using the Tuya android app it works just fine. So seems to be a problem with the new Tuya integration using their IOT developer platform.

Same issue with a WiFi connected Air Con unit, I can control it from HA but the entities for the device (current temp, HVAC mode etc) aren’t updating. If I look at the state of the device via the Smart Life app or in the IOT platform website they are updated correctly.

Reloading the Tuya integration does update the entities to their current state and then it sometimes continues to update for a few hours but then reverts back to not updating, so perhaps the underlying process that’s talking to IOT is crashing or stops?

I am also having this problem, toggle either update slowly or not at all, information as above and no info in the logs. I have tried forgetting the devices and readding them, deleting integration and readding it, hardware for homeassistant has been changed.

Reloading the integration appears to update everything but it immediately goes back to slow non-existant updates to toggles. Automations that change the status seem to not get updated at all and lovelace goes slow but this is not a hard and fast rule.

I have attached teh Tuya API debug log for one light which was turned on over an our ago but is still showing as off in lovelace.

debug

@steve1011011 Interesting, maybe worth casting your eye over the old Tuya V2 integration code written by the same devs (I believe) that was recently abandoned when this one was integrated into core functionality, does that do the same? https://github.com/tuya/tuya-home-assistant

It looks the same setup, in that respect unfortunately.

Tempting to start reflashing some of the Tuya devices with the Tasmota firmware, if I didn’t have so many . . .

@steve1011011 Interesting, maybe worth casting your eye over the old Tuya V2 integration code written by the same devs (I believe) that was recently abandoned when this one was integrated into core functionality, does that do the same? https://github.com/tuya/tuya-home-assistant

Tuya is a myth. Very cheap and it has everything… It only works well within its ecosystem. These experiences have cost me a lot of money and made me change, it was this incomprehensible inability to put an integration to work properly before releasing it. My area is very windy and I have a TUYA wind sensor, as it is not updating status, tonight the wind is blowing strong and the command was not given for the awnings and shutters to close, they flew and broke. Yesterday I left the car and the sensor did not come out, so the garage and street doors were left open and the dogs entered and caused damage in the garden. Enough of Tuya. I’ve already bought 34 door and window sensors and 26 Zigbee motion sensors and will integrate locally with zigbee2mqtt. Tuya has a long way to go before she can be trusted. That connection through a test project, has had the aspect of being soon to be either paid or not, as happened with several in the IFTT. So I thank Tuya for the incentive to spend more but keep everything local, without tests or clouds.

I wrote to Tuya Support:

Community is screaming for an update about what is going on, if you are working on the problem and when it’s estimated to be resolved.

Got reply:

Hello, thank you for waiting. We will update you as soon as we get the result

I have also tried to be not dependent on the tuya servers, so try to use some of them with tuya local. But some of them like motion sensor with Zigbee protocol is still under development in tuya local repo.

The question is, is anything being done? Still haven’t seen any progress anywhere with this issue, nor any feedback of what the hell is going on… As far as I can see this is affecting quite a few users…

I received my last 3 replacement devices today and later tonight I’m out. No more Tuya.

I haven’t quite got to that point yet but I have made a couple of purchases for new kit that wasn’t Tuya but would probably otherwise have been.

I received my last 3 replacement devices today and later tonight I’m out. No more Tuya.

the status problem is not only happening with switches, but also with door and motion sensors. Also the current, power and intensity information only update when they feel like it. I have a power outlet indicating the HA 1500w for 2 days and nothing is connected there… I have the status service active and it worked on Tuya V2 I’m a little unlucky with tuya. First, in Tuya v2, there was an ID change and I had to redo all automations and node red, there are more than 200. Then I went to official and didn’t recognize the door and movement sensors, I went back to Tuya v2. (luckily with backup) Tuya v2 released version 1.6 and there I lost everything again. I went back to v1.5, which worked, but it started to have delays. I switched to official, went back to correcting all automations, and I’m full of problems because of status, power, current and intensity. In the app from tuya and smartthings everything works perfectly. I’m trying to switch to Shelly or devices zigbee on zigbee2mqtt.

There is an issue in the Tuya HA integration repo: tuya/tuya-home-assistant#704

why, they have abandoned that repo it wont get any help

image

Not working 100% for me either. Here is some examples of how it behaves for me: https://youtu.be/K1Su63SmXNg

Ive triple-checked that I have followed the component instructions found here: https://www.home-assistant.io/integrations/tuya/

@tubalainen has a suggestion (did not work for me edit: OR himself either it would turn out unfortunately): https://github.com/home-assistant/core/issues/59874#issuecomment-976223205

So many moving parts with Tuya Cloud - lets hope that our ninja developers soon can sort this component. It is very unreliable at this stage.

Both WiFi and ZigBee devices are not functioning properly, Status update is slow

The LocalTuya integration also has no such issues, I use that for most of my devices but it doesn’t support HVAC at the moment so currently need the official integration for that single device.

There is a caveat, which is wifi sensors such as door and motion sensors do not work with Local Tuya and at the moment those are the ones that are the most broken with this Tuya issue.

My motion sensor are with zigbee protocol. It seems local tuya didn’t support it?

Best asking about LocalTuya compatibility/issues on its own github or via a HA community thread. https://github.com/rospogrigio/localtuya

My motion sensor are with zigbee protocol. It seems local tuya didn’t support it?

The LocalTuya integration also has no such issues, I use that for most of my devices but it doesn’t support HVAC at the moment so currently need the official integration for that single device.

unbind network - they’re talking about IP assignment from the network.

I don’t see this helping as I cleared my address table and there was no improvement

I’m experiencing same behaviour as all other posters stated on this issue.

In my case with 2021.11.4 and OS6.6. Before, with 2021.10.0 was working perfect with 0 lag and stable. I have 3 wall plugs, and a RGB bulb, and all of them have the same issue. When I toggle them trough lovelace, they switch on but status on the icons is not changed, or it lags a lot. Then I toggle again to switch them off and there is no change whatsoever. I have to open the pop-up and toggle the switch multiple times until I can switch off them, but then status on the lovelace button remains as “on”, even 8 hours later.

If it would help the devs, I noticed that if you just reload the integration (configuration --> integrations --> 3dots on the Tuya integration --> reload), the states are all immediately updated. So HA seems at least that way able to get the correct status updates.

I’m experiencing the same issue, for both switches and lights. The device state is physically changed. Eg. toggle light button and light switches on. The problem is the state is still shown as off. I can’t switch off the light. The only way is to do an integration reload. Hope the experts at Tuya can help us resolve this soon. You can’t imagine the number of times i’ve accidentally switch on lights… and not able to turn them off immediately. (-_-||)

As of this morning I’m encountering more or less the same issue with all my Tuya (or via a Tuya Zigbee hub connected) devices while using both the old Tuya integration and the new HA core integration of Tuya. So it seems to me this is an issue with the Tuya API rather than with the Home Assistant integration.

Strangly in the Smart Life app everything works well, states are instantly updated, etc.

Until today I was running HA core_2021.9.7 using the old Tuya integration. This morning the HA app and web GUI were unresponsive.

After a fresh reboot I noticed my Tuya devices were not showing the correct state. I decided to remove the Tuya integration and upgrade to 2021.11.4 and configure the new core Tuya integration. Unfortunately without succes.

When I toggle a socket switch in HA it switches on or off inmediately, however the state in HA remains incorrect for about 10 seconds.

The state changes of my Zigbee motion sensors, connected via a Tuya Zigbee hub, take even a lot longer to update the correct state.

I have the same problem with Wi-Fi double Switch EU, the light is off but in HA it remains on.

Hope they fix this soon.