core icon indicating copy to clipboard operation
core copied to clipboard

Tuya requires regular revalidation after 2024.2.1 update

Open rleatherb opened this issue 1 year ago • 48 comments

The problem

After installing version 2024.2.1 of Home Assistant, where the Tuya account setup changed, I successfully validated my account via SmartLife and all was fine. However, on two separate occasions since then, Home Assistant has disconnected from Tuya. There was no apparent warning, but Tuya devices just didn't work from Home Assistant. On restarting Home Assistant (but not before), on each occasion there was a system message that I needed to revalidate my account, which I did using the QR code. Once revalidated all Tuya devices worked again.

Revalidating my Tuya account every week is simply unworkable. The QR code method means I cannot do this when out of the office as you need a display for the QR code and your phone to input this into SmartLife. Between the connection failing and revalidation no automations involving Tuya devices work, which is unacceptable. The "old" Tuya authentication method worked without issue prior to the latest release.

Am I the only one finding this?

What version of Home Assistant Core has the issue?

core-2024.2.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

rleatherb avatar Feb 16 '24 10:02 rleatherb

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tuya can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tuya Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

home-assistant[bot] avatar Feb 16 '24 10:02 home-assistant[bot]

It happened again today. WhatsApp Image 2024-02-17 at 07 45 14_05e30d1e

Home Assistant appeared to be locked up and I couldn't connect. After restarting it seems that all Tuya devices had stopped responding some time before I needed to restart.

The first time I tried I also got the following error, which persisted until I restarted Home Assistant again, after which I finally managed to reauthenticate successfully. 2024-02-17 07 48 56

rleatherb avatar Feb 17 '24 08:02 rleatherb

Same here after update from 2024.2.1 to 2024.2.2

But it happened only once after update. After the next restart of HA, there was no new authentication required.

HaraldGithub avatar Feb 17 '24 10:02 HaraldGithub

This is occurring frequently for me on restarting Home Assistant.

ancjsd avatar Feb 17 '24 17:02 ancjsd

All my Tuya lights say “Entity not available.”

gmhall506 avatar Feb 18 '24 05:02 gmhall506

All my Tuya lights say “Entity not available.”

If you don't have a "reauthenticate integration" showing under settings, it might appear after restarting Home Assistant. Not a solution, but might get your Tuya integration working again

rleatherb avatar Feb 18 '24 05:02 rleatherb

I just had this happen. I will say.. this is reinforcing my desire to avoid all wifi devices, and I just ordered 2 tuya zigbee smart plugs instead.

matthewbarr avatar Feb 18 '24 05:02 matthewbarr

I am also having this problem, Tuya authentication required - I have the Tuya app, my Tuya developers account seems fine. I have spent hours trying to get the Tuya QR code to get accepted by the Tuya app, Tried everything showing QR code on my iPad, changing my DNS servers back to 8.8.8.8 (Google) - I can't get past the Home Assistant Tuya QR code, keep getting the QR code has expired, please refresh and try again. I would like to be able to skip the QR code and enter my Tuya User Code directly into the Home Assistant Tuya integration.

syersjr avatar Feb 18 '24 15:02 syersjr

I have had this happen a few times too on my new HA install on TrueNAS Scale. It's the only integration that has these problems and it's annoying to have to reload the integration (twice) each time to get it to function properly again. Maybe I should figure out how to do a local control instead. But I'd rather the integration just worked properly instead. Hope you guys can figure it out. Thanks. :)

jorenmartijn avatar Feb 18 '24 19:02 jorenmartijn

I have similar problem, Yesterday After update

Jmphiphi85 avatar Feb 19 '24 12:02 Jmphiphi85

When I update my Home Assistant, the Tuya integration notify that I need to reconfigure.

Then, I tried to reconfigure, but the QR Code doesn't load properly.

To try solve the problem, I opened browser devtool at network tab and proceed to generate QR Code until the rendering error.

Next, I get the response payload and find by an auth token.

When I found, I copied the token and generate the QR Code using a secure app.

I opened the smart life app and scan QR Code generated.

Now I'm about 2 days with my integration running stable again. =)

dvinciguerra avatar Feb 20 '24 00:02 dvinciguerra

A couple of things that stumped me.

  1. I have both the Smart Life app and The Tuya app. The auth code is different on each.

  2. Also, when the browser shows the QR code, on a the mobile app you need to back up two screens, choose the scan icon from the top right, scan the code and click submit back on home assistant.

On Mon, Feb 19, 2024 at 8:07 PM Daniel Vinciguerra @.***> wrote:

When I update my Home Assistant, the Tuya integration notify that I need to reconfigure.

Then, I tried to reconfigure, but the QR Code doesn't load properly.

To try solve the problem, I opened browser devtool at network tab and proceed to generate QR Code until the rendering error.

Next, I get the response payload and find by an auth token.

When I found, I copied the token and generate the QR Code using a secure app.

I opened the smart life app and scan QR Code generated.

Now I'm about 2 days with my integration running stable again. =)

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/110713#issuecomment-1953297055, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASG7BXVXZKLQCXLPCCICXKDYUPSLFAVCNFSM6AAAAABDLZPIBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTGI4TOMBVGU . You are receiving this because you commented.Message ID: @.***>

gmhall506 avatar Feb 21 '24 02:02 gmhall506

Any updates on this 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 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 nor authentication issue.

esotere avatar Feb 21 '24 14:02 esotere

I am also having this problem (Tuya authentication required every reboot) also after updating to 2024.2.2 version.

AriaRobav avatar Feb 21 '24 17:02 AriaRobav

This is happening to me too. Every time I update HA I get the following notification. Authentication expired for “username”

Core - 2024.2.5 Supervisor - 2024.02.0 Operating System - 12.0 Frontend - 20240207.1

sjc073 avatar Feb 29 '24 03:02 sjc073

Same here since last update, prior to that it was working fine. Core: 2024.2.5 Supervisor: 2024.02.1 Operating System: 12.0 Interface utilisateur: 20240207.1

  1. if no immediate action you need to restart again as QR expire and there is no way to regenerate a new one.
  2. you need to be using 2 devices as from a mobile phone only you can't reauthenticate.

AlainPeccable avatar Mar 04 '24 04:03 AlainPeccable

Facing the same issue sadly.

n00b12345 avatar Mar 05 '24 07:03 n00b12345

I've been facing the same problem since the last update: each HASS reboot needs the Tuya integration to be reauthenticated via QR.

Mukh-Samum avatar Mar 07 '24 13:03 Mukh-Samum

According to https://github.com/tuya/tuya-smart-life : "This project has now officially been integrated into the Home Assistant official project core repository, corresponding to version 2024.2." AKA: No more Tuya "Authenticate" needed - just use Home Assistant to discover and add these devices.

JDBalogh avatar Mar 11 '24 00:03 JDBalogh

Same problem here!? Yes, Tuya authentication moved to Home Assistant. I 2 deleted whole Tuya integration and installed and authenticated from within the Home Assistant App. BUT after some days, an error Message is poping up, saying "Authentication has expired 1 Month (or so) ago! Need to reauthenticate Tuya?????
I am running two separate HA Instances with 2 separate Smart Life (Tuya, different users) Integrations. Two HWs (identical configuration), same OS- and HA-Levels, but only 1 (one) is showing this error? The other is working fine.. Please help! Thanks

andreasbuff avatar Apr 10 '24 08:04 andreasbuff

Happened to me today also - my virtual instance for HA was unresponsive, clogging up my CPU. Had to restart the virtual machine. Never happened before.

Core 2024.5.3 Supervisor 2024.05.1 Operating System 12.3

oopiicaa avatar May 12 '24 08:05 oopiicaa

Same issue here.. Running HA OS on RPI PI3A+ Any way to fix it?

spanzetta avatar May 23 '24 04:05 spanzetta

Solved by "forcing" a submit in HA without reading the QRcode in SmarLife app.. then the QRcode is renewed and the reauthentication on SmartLife app did work..

spanzetta avatar May 23 '24 09:05 spanzetta

Same here

anderconsu avatar May 24 '24 20:05 anderconsu

It is now happening quite frequently.. Almost every week.. Why?

spanzetta avatar Jun 06 '24 05:06 spanzetta

Same issue here, now happening every day 😢 Here's the log chunk:

2024-06-09 09:23:26.431 ERROR (SyncWorker_0) [tuya_sharing] net work error = network error:(1010) token is expired
2024-06-09 09:23:26.497 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <my_email_address> for smartlife
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartlife/__init__.py", line 69, in async_setup_entry
    await hass.async_add_executor_job(smart_life_manager.report_version, __version__, smart_life_version, sharing_sdk)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/manager.py", line 69, in report_version
    self.user_repository.user_version_report(ha_version, integration_version, sdk_version)
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/user.py", line 46, in user_version_report
    self.api.post("/v1.0/m/life/home-assistant/qrcode/versions", None, {
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
    return self.__request("POST", path, params, body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 121, in __request
    raise Exception(f"network error:({ret['code']}) {ret['msg']}")
Exception: network error:(-9999999) sign invalid

Nebneb avatar Jun 09 '24 07:06 Nebneb

Same issue here, now happening every day 😢 Here's the log chunk:

2024-06-09 09:23:26.431 ERROR (SyncWorker_0) [tuya_sharing] net work error = network error:(1010) token is expired
2024-06-09 09:23:26.497 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <my_email_address> for smartlife
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartlife/__init__.py", line 69, in async_setup_entry
    await hass.async_add_executor_job(smart_life_manager.report_version, __version__, smart_life_version, sharing_sdk)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/manager.py", line 69, in report_version
    self.user_repository.user_version_report(ha_version, integration_version, sdk_version)
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/user.py", line 46, in user_version_report
    self.api.post("/v1.0/m/life/home-assistant/qrcode/versions", None, {
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
    return self.__request("POST", path, params, body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 121, in __request
    raise Exception(f"network error:({ret['code']}) {ret['msg']}")
Exception: network error:(-9999999) sign invalid

Same error here;;;

Core 2024.6.1 Supervisor 2024.06.0 Frontend 20240605.0

ajcorrea avatar Jun 09 '24 16:06 ajcorrea

seeing the same here: "net work error = network error:(1010) token is expired"

DareVanReed avatar Jun 11 '24 10:06 DareVanReed

Solved it doing this:

  • Delete the device then adding again.

ajcorrea avatar Jun 11 '24 15:06 ajcorrea

I had to delete the entire integration, and re add it. Thankfully all the device names stayed the same 👍

DareVanReed avatar Jun 11 '24 17:06 DareVanReed