home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.82k stars 30.08k forks source link

ℹ️ Tuya integration not working #80278

Closed thecode closed 7 months ago

thecode commented 1 year ago

EDIT: From Home Assistant Core 2024.2.0 a developer account is no longer needed. If you don't see the QR Code (Invalid hex color) temporally switch Home Assistant Theme to the default theme (Fixed in 2024.2.1).

Full details can be found in the Tuya integration documentation

Tuya has provided an easier and improved login method for Home Assistant users. Having a developer account with Tuya is no longer required; instead, you can scan a QR code with your Tuya Smart of Smart Life app to authenticate it with Home Assistant.

After the upgrade, Home Assistant will ask you to re-authenticate your Tuya Smart or Smart Life account using this new method.

QR Code

QR Code Migration


The problem

Tuya integration stopped working Recently there are many complains about Tuya integration not working, most of them are due to expired Tuya IoT Platform trial period for the account.

In order to make your Tuya integration working again you need to extend your trial period, do extend the trial period do the following:


EDIT: Please first try to only "Unlink your Tuya App Account and add it again after unlinking" (last step 5 here) and only if it doesn't work go through the whole process image


  1. Login to Tuya IoT Platform
  2. Select Cloud and Cloud Services image
  3. Find your IOT Core and click on View Details on the right image
  4. Click Extend Trial Period image
  5. Fill in your details, don't forget to make them aware you don't like it: "Please work with Home Assistant to remove the need for these dumb developer accounts. Thanks" (feel free to rephrase as you wish) image
  6. Now you need to wait until review is over image

After approval, renewal is done / accepted:

  1. Login again and select Cloud andDevelopment` image
  2. Select your project image
  3. Select Devices image
  4. Select Link Tuya App Account image
  5. Unlink your Tuya App Account and add it again after unlinking image

I have followed this process but it still doesn't work:

If your account was expired and it still doesn't work after, contact Tuya IoT Platform support to help resolving the problem. If your account is not expired, please do not comment on this issue and create a new one

Thanks @frenck for the detailed screenshots

home-assistant[bot] commented 1 year ago

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! (message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

macabrismix commented 1 year ago

thx

scruysberghs commented 1 year ago

Just noticed my tuya iot subscription actually expired somewhere last april but everything worked fine. So the upgrade to 2022.10.3 somehow triggered the problem? Getting the 'code': 2406, 'msg': 'skill id invalid' without changing anything today. Even added a device yesterday without problems... Anyway, requested the 6 months extra trial...

craigsad77 commented 1 year ago

Yep upgrade broke my integration as well. Same error 2406. Iot subscription still valid.

frenck commented 1 year ago

So the upgrade to 2022.10.3 somehow triggered the problem?

It is more likely the restart of Home Assistant during the upgrade triggered it (as you disconnect from the Tuya IoT cloud momentarily at that point).

frenck commented 1 year ago

Yep upgrade broke my integration as well. Same error 2406. Iot subscription still valid.

Please contact Tuya IoT support in that case, by logging in to your Tuya IoT cloud account and submitting a request.

luca-angemi commented 1 year ago

Yep upgrade broke my integration as well. Same error 2406. Iot subscription still valid.

Please contact Tuya IoT support in that case, by logging in to your Tuya IoT cloud account and submitting a request.

Do you know if switching to Local Tuya work around this issue?

frontendbuddy commented 1 year ago

@luca-angemi I have one heater added to localtuya integration and I can see that it does work through it while the Tuya Cloud based integration does not.

frontendbuddy commented 1 year ago

Guys, can you go to the API Explorer and try to use General Device Capabilities -> General Device Status -> Get the status of a single device with your device ID? The device ID itself you get from the list of the Devices in your project.

I am getting this message: "msg": "No permissions. Your subscription to cloud development plan has expired.",

I got the IoT Core and Cloud Develop Base Resource Trial extended to April 2023 few days ago. So this message above means that they do have an issue with extending these trials.

Does it look the same for you after applying for the trial period extension?

thecode commented 1 year ago

Guys, can you go to the API Explorer and try to use General Device Capabilities -> General Device Status -> Get the status of a single device with your device ID? The device ID itself you get from the list of the Devices in your project.

I am getting this message: "msg": "No permissions. Your subscription to cloud development plan has expired.",

I got the IoT Core and Cloud Develop Base Resource Trial extended to April 2023 few days ago. So this message above means that they do have an issue with extending these trials.

Does it look the same for you after applying for the trial period extension?

Yes, they have a problem with the trial extension, contact support and they will fix it

craigsad77 commented 1 year ago

My API tests were successful. I’ll try delete the integration and re add.

frenck commented 1 year ago

I’ll try delete the integration and re add.

That is unneeded. Just reload the integration (or restart HA).

CrottyFr commented 1 year ago

same problem for me tonight, solved simply by unlinking and relinking the app

https://community.home-assistant.io/t/tuya-integration-error-2406-skill-id-invalid/372831/9

frenck commented 1 year ago

@applegeeks, I've hidden your comment. The reasoning is: No-one should even manually edit the registries. It can cause some serious issues, and therefore telling people to do that is harmful.

Anybody reading that, please take that into account.

applegeeks commented 1 year ago

@frenck ack. yes ofcourse. it definitely comes with disclaimer for advanced users only and making sure to take a backup prior (I always take a a ha backup + vm backup before any major changes).

Regardless, I have removed it for now to be safe :)

meetheed commented 1 year ago

I've had this today. Turns out my trial expired 11 months ago so I've requested an extension. It's been running that long with an expired trial no problem. This week I've been redoing a lot in home assistant and making a few changes such as adding ZigBee. It's been rebooted 20 or more times in the last few days, Including being powered off for hours at a time while I moved it around and replaced my home router / network. It was fine last night and this morning. It is only after I installed the latest HA update this morning that the error started. something about that update caused the integration to realise the trial was over. It's not linked to rebooting.

thecode commented 1 year ago

I've had this today. Turns out my trial expired 11 months ago so I've requested an extension. It's been running that long with an expired trial no problem. This week I've been redoing a lot in home assistant and making a few changes such as adding ZigBee. It's been rebooted 20 or more times in the last few days, Including being powered off for hours at a time while I moved it around and replaced my home router / network. It was fine last night and this morning. It is only after I installed the latest HA update this morning that the error started. something about that update caused the integration to realise the trial was over. It's not linked to rebooting.

I assume when people started contacting Tuya they found a bug in their account trial system and fixed it. I have looked at the code changes for the Tuya integration and it is very unlikely that they caused it to stop working.

You can downgrade your version from a backup and check that

atv2016 commented 1 year ago

Yeah i'm getting this since today. config entry for tuya integration not ready yet: {'code': 2406, 'msg': 'skill id invalid', 'success': False, 't': 1665698571055, 'tid': 'c7cb98aa4b4211eda7a6d2b5cc5248de'}; Retrying in background

My authorisation was expired a long time ago, i renewed it now, let's see if it works in the morning.

Atako30 commented 1 year ago

Unlink and link again Account helped without asking for trial extension. How to do it here: https://community.home-assistant.io/t/tuya-integration-error-2406-skill-id-invalid/372831/9

thecode commented 1 year ago

Unlink and link again Account helped without asking for trial extension. How to do it here: https://community.home-assistant.io/t/tuya-integration-error-2406-skill-id-invalid/372831/9

This is interesting, would be good if others try it, it is also shown on the last step 5 beginning of this post: image

atv2016 commented 1 year ago

Just tried, that fixed it.

scruysberghs commented 1 year ago

as another datapoint. This morning here everything Tuya works again in HA. The 2406 message on the tuya integration screen in Home assistant disappeared. My "IoT Core" subscription renewal status still is "Your application for extension is being reviewed." Did not unlink/re-link. Looks to me like it was a temp problem on Tuya's end...

I did play around a little with Tuya's API explorer last night and was able to control my devices that way at the time HA still had the error message. Maybe that triggered something?

frenck commented 1 year ago

I did play around a little with Tuya's API explorer last night and was able to control my devices that way at the time HA still had the error message.

You can always control via the API explorer, that is unrelated.

meetheed commented 1 year ago

as another datapoint. This morning here everything Tuya works again in HA. The 2406 message on the tuya integration screen in Home assistant disappeared. My "IoT Core" subscription renewal status still is "Your application for extension is being reviewed." Did not unlink/re-link. Looks to me like it was a temp problem on Tuya's end...

I did play around a little with Tuya's API explorer last night and was able to control my devices that way at the time HA still had the error message. Maybe that triggered something?

Same here. My extended trial is still awaiting review but everything is up and running again today. I didn't unlink and relink, all I did was apply for a trial extension.

niemyjski commented 1 year ago

Thanks for the guide... I hope Tuya is reading this (also left comments when renewing sub in mean time). I am replacing my few tuya devices with ESPHome compatible devices, orders placed.

On a side note, I hope the Works with program (and partnership with Tuya?) does something about this...

frenck commented 1 year ago

On a side note, I hope the Works with program (and partnership with Tuya?) does something about this...

@niemyjski We don't have a partnership with Tuya. Tuya is not part of the Works with Home Assistant program either.

Whytey commented 1 year ago

The unlink/relink worked for me.

Tuya is a pain in the ass, I wish it wasn't so available.

I think this can be closed as not a bug on the HA side.

I guess the Works with Home Assistant program is about giving some assurance in the stability of the integration. I wonder if there is some way to provide a community rating program for those integrations that aren't in the program.

frenck commented 1 year ago

I think this can be closed as not a bug on the HA side.

We created this issue to prevent tons of other being created, while not an HA issue, we keep it afloat/open for a bit.

AutiCodes commented 1 year ago

All my Tuya stuff down, this was the issue, your a king!

sanketthakur2001 commented 1 year ago

Same issue here. Requested extension - was approved till April 2023. unlined - linked, following the mentioned steps. restarted HA multiple times. still no luck. Hope someone has another solution.

Going to try and restore to HA core_2022.9.7

frenck commented 1 year ago

Going to try and restore to HA core_2022.9.7

@sanketthakur2001 That won't change a thing. Please contact Tuya support as was also written in the issue description above:

CleanShot 2022-10-14 at 15 57 59

rvermill commented 1 year ago

I went through the whole process noted at the beginning of this thread and mine works fine now. Thanks y'all!

CinciRyan commented 1 year ago

Right now (10:50am ET USA) it appears the Tuya Cloud webpage is down. Other functions in the IoT platform work, but nothing under Cloud loads. I'd say it's them right now. I can't tell if my account is expired or not for the time being. Can confirm the SmartLife app is still working.

OldManOfTheSea69 commented 1 year ago

What’s strange for me is that everything works fine except automations. I can turn TUYA devices on/off manually through the HA dashboard and when I use a switch I see the automations triggered in HA when I press various buttons but the connected TUYA devices don’t turn on/off or toggle. Any suggestions would be appreciated.

(FWIW other buttons controlling zigbee devices via DeConz are running their automations OK).

frontendbuddy commented 1 year ago

My issue has been solved after contacting Tuya support, I can now call API and also my integration works on HA. I guess, it's time to dump the device details from the API along with the Data Point Id's.

thecode commented 1 year ago

What’s strange for me is that everything works fine except automations. I can turn TUYA devices on/off manually through the HA dashboard and when I use a switch I see the automations triggered in HA when I press various buttons but the connected TUYA devices don’t turn on/off or toggle. Any suggestions would be appreciated.

(FWIW other buttons controlling zigbee devices via DeConz are running their automations OK).

Please create a new issue, this is not related

bobsilver commented 1 year ago

Unlinking and relinking solved the problem. No need for anything else.

frenck commented 1 year ago

Unlinking and relinking solved the problem. No need for anything else.

It depends on your case, if your account didn't expire... sure, that might work. The new Tuya integration was introduced about 12 months ago, at the time, a 12 months trial was provided. So, for many, their accounts expire right now.

bobsilver commented 1 year ago

My account had expired. I renewed it but was in the review state. Then I did the unlink / relink and restarted HA. All good immediately. In any event appreciate those who figured it out.  But sure be nice to have a normal account connection with Tuya.

Bob Silver @.*** 408.472.5209

Sent with Spark On Oct 14, 2022 at 2:10 PM -0700, Franck Nijhof @.***>, wrote:

Unlinking and relinking solved the problem. No need for anything else. It depends on your case, if your account didn't expire... sure, that might work. The new Tuya integration was introduced about 12 months ago, at the time, a 12 months trial was provided. So, for many, their accounts expire right now. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

frenck commented 1 year ago

@bobsilver

But sure be nice to have a normal account connection with Tuya.

Agreed! Please send a support ticket to Tuya to let them know 👍

ischorr commented 1 year ago

Thanks guys. Happened to me today (or maybe late yesterday), although my expiration was actually marked Feb 2022. I assume they just started enforcing expirations today/yesterday. Waiting for review.

Agree these headaches give me more motivation to keep replacing my remaining Tuya devices and never buying another one.

sanketthakur2001 commented 1 year ago

So I made a new account I can see all devices now in my HA. Devices are working fine. But automations are still now working. Have tried everything possible now

z1rr3 commented 1 year ago

Happened to be too. But for the there is no devices, but i can add a new Tuya integration. I tried also to make a new project in Tuya IoT and no difference. I can see the devices there, but I cant see them in HA. I deleted and readded multiple times and did also restart each time. And it all started when updated to : 2022.10.3 bild Can someone help?

mioCry commented 1 year ago

Hello everyone, I had the same problem a few days ago, after the trial month my Tuya devices were no longer visible from Home Assistant. Consulting this forum I found the right indication. I asked for the renewal of the 6 months process version. I checked today and the request was accepted. Confirmation emails are not sent. Too bad for this renewal procedure (not so if in six months the request will be accepted again) Once the request has been accepted, HA must be restarted and the devices become visible again, I have lost the labels. Tuya_1.pdf Tuya_2.pdf

thecode commented 1 year ago

Happened to be too. But for the there is no devices, but i can add a new Tuya integration. I tried also to make a new project in Tuya IoT and no difference. I can see the devices there, but I cant see them in HA. I deleted and readded multiple times and did also restart each time. And it all started when updated to : 2022.10.3 Can someone help?

Can you attach in a comment (drag to a comment, not copy paste) Home Assistant log after restart? In parallel I suggest to contact Tuya support, many had problems even after renewing and Tuya support fixed it for them.

NateEaton commented 1 year ago

Thanks for this and for the updated approach note (i.e., just doing the five steps under "After Approval", not the earlier steps). That worked for me and the integration in HA immediately started working again.

BTW, the 6 month trial subscription in the dev portal is apparently meaningless (as implied by the updated instructions here); mine expired at the end of December, 2021. Good to know that I don't need to go extend it every 6 months for the integration to still work.

I should mention that this was actually working fine this morning but was erroring off after I updated to HA Core 2022.10.4. As this wasn't listed as a breaking change in the release notes and the 6 month trial expiration didn't appear to be involved, I'm not exactly sure why this broke but I'm glad it is fixed.

Also, I don't recall seeing a detailed description (either here or on the Tuya Integration page) that addresses one step: when adding Tuya app account after unlinking it, there is a prompt for two settings, whether to automatically add new devices or not and what device permissions to add. I assume that Read Only (the default) is insufficient since HA needs to control the devices but I wasn't sure whether to pick Read/Write/Control or Read/Write/Control/Manage. I picked the latter. If HA really doesn't need Manage, I guess I can repeat these steps and just pick Control.

frenck commented 1 year ago

but was erroring off after I updated to HA Core 2022.10.4. As this wasn't listed as a breaking change in the release notes

@NateEaton it is not a change or issue in HA, so indeed there is nothing in our release notes. You upgrading connected/disconnected you from the Tuya cloud (which just triggered it). There is nothing on our end we can or could do about it. HA didn't cause it either.

z1rr3 commented 1 year ago

Home Assistant log

Dont understnad how to drag and drop it, but copy it. See if this works.

Have also got the review done from Tuya and its for 6 additional month. Have restarted the integration and restarted HA.

No difference of course.

Fullständiga loggar

2022-10-16 10:56:31.578 ERROR (Thread-3) [tuya_iot] error while get mqtt config
2022-10-16 10:56:31.599 ERROR (Thread-3) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/site-packages/tuya_iot/openmq.py", line 161, in run
time.sleep(self.mq_config.expire_time - 60)
AttributeError: 'NoneType' object has no attribute 'expire_time'
2022-10-16 10:56:32.283 ERROR (MainThread) [homeassistant.components.media_player] Error adding entities for domain media_player with platform yamaha_musiccast
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:32.293 ERROR (MainThread) [homeassistant.components.number] Error adding entities for domain number with platform yamaha_musiccast
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:32.297 ERROR (MainThread) [homeassistant.components.select] Error adding entities for domain select with platform yamaha_musiccast
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:32.302 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform yamaha_musiccast
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:33.032 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up yamaha_musiccast platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:33.036 ERROR (MainThread) [homeassistant.components.number] Error while setting up yamaha_musiccast platform for number
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:33.040 ERROR (MainThread) [homeassistant.components.select] Error while setting up yamaha_musiccast platform for select
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:56:33.044 ERROR (MainThread) [homeassistant.components.switch] Error while setting up yamaha_musiccast platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 529, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/yamaha_musiccast/__init__.py", line 193, in device_info
for mac in self.coordinator.data.mac_addresses.values()
AttributeError: 'str' object has no attribute 'values'
2022-10-16 10:57:15.794 WARNING (MainThread) [homeassistant.config_entries] Config entry 'R8000 (Gateway)' for upnp integration not ready yet: Unable to communicate with IGD at: http://192.168.0.1:5000/Public_UPNP_gatedesc.xml; Retrying in background
2022-10-16 10:57:17.189 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: netgear
2022-10-16 10:57:26.761 WARNING (SyncWorker_3) [homeassistant.components.waze_travel_time.sensor] Error on retrieving data: empty response
thecode commented 1 year ago

Home Assistant log

Dont understnad how to drag and drop it, but copy it. See if this works.

Have also got the review done from Tuya and its for 6 additional month. Have restarted the integration and restarted HA.

Did you unlink and relink your app as explained?

z1rr3 commented 1 year ago

Home Assistant log

Dont understnad how to drag and drop it, but copy it. See if this works. Have also got the review done from Tuya and its for 6 additional month. Have restarted the integration and restarted HA.

Did you unlink and relink your app as explained?

Sure did