Tuya authentication expired

After the update to HA 2024.7.2 I get this error
image

When I scan the QR code using the Tuya smartlife appliction, it says the QR code has expired, probably because HA generates this when the error was produced, a few days ago.

When I click the reconfigure button, the QR code appears
How can I delete and reinstall the integration, or refresh the QR code ?

Update/Solution:

I just rebooted HA, and scanned the QR code immediately after the reboot, and then the authentication worked.

I decided to post this, even when I found the solution myself now, but perhaps it can help others who encounter the same problem.

17 Likes

Thanks, this works.

Yes, it worked for me as well. Thanks for the information.

Thanks @mbbs1024 - helped me out too - had to reboot and do within a short time - after 10 minutes or so was too late

Thanks, this works!

Thanks, this works!

You are a hero, thank you!

Thanks, it worked on 2024.12.3 as well.

Hi guy’s!
I meet the same behavior and after the HA restart, the QR code is well renew and the new registration work again.
What i don’t understand is why every couple of day i have this problem of registration.
I have this problem during a while and now in 2024.12.3 i’ve got alway the same behavior.
It’s very anoying, if anybody have an idea about what’s happen with TUYA or know a workaround about this.
best regards

Just had the problem today, and find another easy solution :

Just connect to HA with privacy session in your browser, the qr code will work first try :slight_smile:

did not work for me :frowning:
any other ideas?

Try this one, seem to be a problem of timing :slight_smile:

Restart HA, and RIGHT AFTER you got the warning that tuya need re configuration, click it and scan the QR code.

Thanks… This worked for me too… I have been struggling with this, and THOUGHT I had done it quickly enough, but I guess not! now it’s working again!

Thanks, this solution worked for me too.

Thanks, it works!

I have the same issue, but with smartlife instead of tuya.
This is what i have in the logs.

If i go to the integration, click Add Hub, add it again, (enter the code, scan the qr, submit), it adds the devices again, and i can just delete the old hub after that. But this needs to be done after EVERY restart.

Any permanent solution?

Logger: tuya_sharing
Source: /usr/local/lib/python3.13/site-packages/tuya_sharing/customerapi.py:160
First occurred: February 14, 2025 at 6:34:29 PM (38 occurrences)
Last logged: 10:41:42 AM

  • net work error = network error:(1010) token is expired
  • net work error = Detected that custom integration ‘smartlife’ calls hass.config_entries.async_update_entry from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see Thread safety with asyncio | Home Assistant Developer Docs at custom_components/smartlife/init.py, line 261: self.hass.config_entries.async_update_entry(self.entry, data=data). Please report it to the author of the ‘smartlife’ custom integration

is there a way to stop the authentication expiring?

don’t want to keep repeating this process.

thanks