Tuya integration issues (Network Errors / 104 -999999 / LocalTuya)

I’m having some real issues with the Tuya integration… around once a day it will just stop successfully to my devices. I.e. I tell it to turn a socket off and it will sit for a second then flick back on. Only way to fix is with a restart of the integration and then it works fine.

Just ran some debug logging (on the Tuya integration, which is the one broken), and I’m seeing a lot of errors for LocalTuya…

2025-01-02 09:07:44.553 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 3008251550029153bf13
2025-01-02 09:07:44.899 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id bf48d9d0291651545fxf0j

etc
This may be simply because I only use LocalTuya for a few devices and have chosen not to set up others, but still seems odd…

Also in the UI I sometimes (but not always) get this:

Failed to perform the action switch/turn_off. ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

As I say - if I restart the Tuya integration it all works, but somethings is up and I’d really like to try get to the bottom of it!

Any ideas?!

I’ve had this same issue. Not a great fix but more of a band aid IMO. I use a simple automation triggered once/hr to perform the action of “reload config entry”.

target:
  entity_id:
    - sensor.socket_light_power
data: {}
action: homeassistant.reload_config_entry

I don’t know if this is a LocalTuya - Tuya conflict either.

1 Like

I’ve tried a similar hack which reloads the integration, it’s definitely not a fix tho! Glad I’m not alone

Been tracking the errors I’m seeing when I try and manually change the devices (annoyingly there doesn’t seem to be any error through automation in most cases, especially calling Tuya scenes which I need for a couple of devices)

Failed to perform the action light/turn_on. (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))`

I also get an error in UI which I haven’t managed to catch yet but it says something about -999999

Very strange as they all work through the smart life app, are definitely on the network, will work after an integration restart

Also I’m less and less convinced this is related to LocalTuya since it’s affecting devices that don’t use local Tuya as well

Managed to catch the other error:

Failed to perform the action switch/turn_on. network error:(-9999999) sign invalid

I’ve also found that overall, in most cases, repeating the action a second time works… even without a restart, which is all very well, but doesn’t help catch issues without creating follow up actions for every Tuya device

Edit:
For example, some testing and this seems to work every time in NodeRed:


The error is caught on the first attempt and then the command is re-pushed
But that doesn’t help when I’m trying to action something from UI or automation, and it would be very painful to update for every tuya device.
I also can’t find a way of detecting a call for the state change so it would create a lot of issues to resend the command
It really feels to me this is an issue with the integration