Tuya integration Broken 02/2024?

This is still broken for me. As soon as i upgrade to this and authenticate, Tuya devices do not work properly in Home assistant.

i face below two issues:
1- the entity stops working. It shows under integration but the switch is greyed out.
2- the switch ( specially wifi gang switches) show as on even when they are off in smartlife app. This is messing with my automations.

If anyone has a way around it , it would be greatly appreciated!

Thanks

1 Like

Any updates on this issue? Were you able to resolve the issue? Been having the same problem since the 2024.2 update, So far the only lasting solution is downgrading the update to 2024.1.~ otherwise one would have to keep reloading the integration or restart HA continuously in order for some automations to work.

I have attempted ALL the steps and/or solutions suggested. Yes, my automations seem to work at first, and yes the states and entities are available but then for some reason they just cease to work. For instance after reloading the integration the motion sensors turn on the lights as expected, however, when the sensor is cleared in the original app in HA it stays stuck on “Detected” and the lights remain on indefinitely until I manually turn them off or reload the integration or restart my instance.

Any assistance or suggestion will be much appreciated.

Edit**
Note: This is neither a configuration or authentication issue.

1 Like

same issues here.
Everything was working well and suddenly yesterday tuya devices status became incorrect and control them became weird. Toggle does not work any more in automations. I can turn on devices with HA but not turn them off.
I use Tuya cloud integration.
Nothing I did fixes the issue.
Tuya native app and Alexa still report and control normally all the devices.

1 Like

Hi, after reading all the Tuya problems with the new integration, I’m still stuck with the Home Assistant version 2024.1.6. Tuya still having problems with the 2024.2.4 update? I have pir sensors, switches and trv thermostatic valves. Thank you in advance

I’ve just upgraded from 2023.12 to 2024.3, reconnected the Tuya integration, all devices and entities are appearing but Tuya scenes don’t work anymore – they’re called apparently successfully, but nothing happens.

Anyone else with this issue?

not a permanent sollution, but:
I wrote an automation that sets the sensor state to off via a python script afer a minute of the sensor being on… this works well but im not 100% satisfied with it

I just updated to 2024.3.2 and my Tuya Integration broke. I tried re-authenticating several times but it told me the code had expired. I couldn’t find a way around this so I restored a 2024.3.1 backup from this morning and everything worked fine again.

1 Like

Tuya stopped working for me as well as lots of other users after their last update to QR code based authentication: Issues · home-assistant/core · GitHub

I am constantly getting:

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 17, in remap_value
    return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
             ~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'

None of my lights are working. Lots of other people are also facingthe same issue.

Having the same issue with some switches. Whenever HA boots up for the first time, some of my switches show as ‘on’ state even when they are off. I was considering writing an automation/script to turn them off after HA boot but then I didn’t know how I would handle the cases of the switches really being in the ‘on’ state.

How did you get around this? Could you share your python script?

1 Like

New to HA. I setup Tuya integration with 2 devices (socket + light), the light integration had issues and would always revert to a switched off state even though I’d switch it on.

deleted the integration and followed the steps to install the Smartlife integration from Tuya’s GitHub. Not too difficult, however the same issue still persists.

My Smart Socket works like a charm, however the Smart light keeps reverting to a switched off state although the light is switched on. I don’t have this problem on the SmartLife app itself.

Is anyone else having the same problem?

Still broken (or broken again…) It could be fixed but the decision seems to be to leave it broken … https://github.com/home-assistant/core/pull/121731

#--------------------------------------------------------------------------------------------------
# Set the state or other attributes for the entity specified in the Automation Action
#--------------------------------------------------------------------------------------------------

inputEntity = data.get('entity_id')
inputStateObject = hass.states.get(inputEntity)
inputState = inputStateObject.state
inputAttributesObject = inputStateObject.attributes.copy()

newState = data.get('state')
if newState is not None:
    inputState = newState
    
newIcon = data.get('icon')
if newIcon is not None:
    inputAttributesObject['icon'] = newIcon

hass.states.set(inputEntity, inputState, inputAttributesObject)