Tuya wifi switches toggle off after on

Me as well. Re-loading the integration synchs it up properly. not a fix but a way to adjust it.

Yup also have this issue seems I have to reload two to 3 times a day Iā€™m
About to chuck everything Tuya outside in the snow

Thanks for this! Should I completely wipe my original Tuya integration prior?

Iā€™ve been having the same issue of Tuya switches turning off after a second. A server restart always fixes things, but just temporarily. It was working great until one of the 2021.12.* updates. I donā€™t mind going back to Local Tuya for my plugs and switches. I also have a Tuya climate device where the automations seem to be running correctly, but the device info isnā€™t synced with HA dashboard correctly unless I restart. I hope our developers can get this sorted out.

There are multiple reports on GitHub from users facing the same issues. It seems the problems are entirely on the Tuya cloud side.

If you look on the GitHub reports, some have suggested how to use an automation to periodically re-load the integration to keep devices in sync. This is probably preferable to restarting the whole of HA to get the same result.

2 Likes

Thanks! I added this automation. Hopefully it helps.

alias: Fix - Reload Tuya Integration
description: ''
trigger:
  - platform: time_pattern
    minutes: '01'
    seconds: '01'
condition: []
action:
  - service: homeassistant.reload_config_entry
    target:
      device_id: **ADD YOUR OWN TUYA DEVICE HERE**
mode: single
1 Like

Clunky way to do it, but this may be the fix. Or, put an outlet on whatever the device is, and leave the switch on. Alternatively, I have a switch that works with VeSync, and that one / integration is working right.

same issue here. I hope this get fixed soonā€¦ my wife is going crazy because my automations are failing because of this problem

Did you try the automation in jayste4's post?

Reload the integration seems to work. Possible to automate?

Made it, working like a charm. Thanks!

This solution seems to work. Thanks!

Iā€™ve found that while it works most of the time, itā€™s not perfect. The automation fires once per hour, but I think the Tuya communication loss sometimes happens just after the automation fires which results in errors until the automation fires again.

Someone mentioned an automation that fires when a Tuya error is logged, but I have not been successful at getting that to work.

I was having trouble with my WiFi sockets, they would work but the toggle button in HA always flipped back to on even if they were actually off. I just updated core to 2021.12.5 and itā€™s fixed my issues.

2021.12.5 has not fixed mine. Same problem of toggling off along with all the other Tuya probems.

Same thing here. Hacks and work-arounds donā€™t work, either.

Do we have any update on this? Reloading the integration even so often does not seem like a great fix as it still can become an issue between relaods. I have a simple automation for a aqara button to toggle the lights in the office and it constantly does not work because of this issue. Has anyone from the Tuya ā€œOfficalā€ Integration said anything?

You guys need to try this which work great for me. Add automation.yaml and be sure to add into configuration.yaml because if you donā€™t this will not work

automation yaml

automation:
  - alias: Tuya Auto Reboot
    id: unique-id
    trigger:
      - platform: event
        event_type: system_log_event
        event_data:
          level: ERROR
          name: tuya_iot
    condition:
      - condition: template
        value_template: >-
          {{ "error while get mqtt config" in trigger.event.data.message[0] }}
    action:
      - service: homeassistant.reload_config_entry
        data:
          entity_id:
            - switch.tuya_1
            - switch.tuya_2

configurations yaml

system_log:
  fire_event: true

This solutions is post by someone, I forget where it isā€¦ so again you know who you are. Kudos.

Well tuya devs are slow to fix anything.
13 days or so of issues and only in last day or so they show up

Tuya device entities stop updating. Ā· Issue #62595 Ā· home-assistant/core (github.com)

The suggested fix worked for me.

I think updating to 2021.12.05 didnā€™t actually fix my issues with Tuya. I think the fact that I reboot after an update got things working temporarily.

It it now working better for me after I changed the cloud server location. I think when I initially signed up I selected Western Europe. This is not an option now and I noticed no devices listed in the cloud, so I had to go through disabling the integration in HA, unlinking from my phone app from their cloud, enabling Central Europe data enter (which is a bit strange as I live in Western Europe but I suppose it doesnā€™t matter), relinkling my app to the cloud, making sure my devices listed in their cloud, re-enabling and putting in credentials to Tuya integration in HA. It works for me ok nowā€¦ for the moment.