tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
856 stars 206 forks source link

Tuya V2 not visible after installation #593

Open MilesAheadToo opened 2 years ago

MilesAheadToo commented 2 years ago

Describe the bug I followed all the steps for the HACS installation

Expected behavior As per the installation instructions, once I reboot HA I should be able to install Tuya V2 from Configuration > Integrations > ADD INTEGRATION, search for the keyword tuya and select Tuya v2.

Screenshots image

Home Assistant Version image

Device info (please complete the following information, which can be found in log):

This is the only message I can find in the logs that related to tuya_v2

2021-10-17 14:55:13 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration tuya_v2 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

Device specifications (please complete the following information, which can be found in log):

Since I haven't been able to setup Tuya V2 there are no devices.

Additional context Add any other context or logs about the problem here.

rbalaev commented 2 years ago

There are also no devices in the home assistant. image image

rbalaev commented 2 years ago

I solved the problem, the way in the pictures! image image

MilesAheadToo commented 2 years ago

You're a STAR!!!

MilesAheadToo commented 2 years ago

Ugh!! While it is true that Tuya V2 now shows up in the integrations, the integration fails. I first got a cryptic error message - sorry I didn't make a note of it, but something along the lines of "The installation ahs failed." I then clicked on the + Add Integration button again and I get the following popup that spins for ever.

image

I'll try to look at the log and post more info.

MilesAheadToo commented 2 years ago

I have restarted HA, and it starts just fine, and seems to be operating just fine. I can look at the different integrations, and I even went into HACS and reinstalled Tuya V2. No errors. I got the same message about rebooting. So I did.

Once HA was up again I went in Configuration > Integration > + Add Integration, and I immediately get the same graphic as above.

HELP!!!

PimDoos commented 2 years ago

Are you on 2021.10.0 or later? You should then remove tuya_v2 from your custom integrations, as TuyaV2 is now integrated into Home Assistant Core. Having both installed may cause issues.

MilesAheadToo commented 2 years ago

Sorry, I meant to add that the logs are nearly empty.

This is the code in my configuration.yaml

`

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

zeroconf: history:

media_source:

frontend: themes: !include themes.yaml

logger: default: critical logs: custom_components.tuya_v2: debug `

MilesAheadToo commented 2 years ago

Are you on 2021.10.0 or later? You should then remove tuya_v2 from your custom integrations, as TuyaV2 is now integrated into Home Assistant Core. Having both installed may cause issues.

I posted a screen shot from Supervisor > System

I will now have to see how I can remove the integration. Perhaps I will start with HACS and work backwards.

I was trying to look for the newest version because I have 23 devices on iot.tuya.com, but on 12 show up in HA.

Any thoughts on that?

PimDoos commented 2 years ago

Are these device types one of the supported platforms? For ex. sensors and covers are not yet supported by the integration.

MilesAheadToo commented 2 years ago

Are these device types one of the supported platforms? For ex. sensors and covers are not yet supported by the integration.

Lots are switches. There are also sensors.

MilesAheadToo commented 2 years ago

In the end I restored a backup from last night. Now I have the majority of my Tuya devices running on localtuya.

Unfortunately localtuya does not support climate and other functions of thermostats, and I have 4 Tuya-based thermostats. The device type covered by localtuya are:

Clearly none of these device type is suitable for a thermostat, and the thermostat response time does not need ot be in milliseconds, so I thought I would just leave then on the Tuya cloud-based integration. Huh! Well, what do you know, I reinstalled the default Tuya integration using credentials that were accepted, and now I do not see any devices in the Tuya integration. :-(

Thoughts?

danielbrunt57 commented 2 years ago

I solved the problem, the way in the pictures! image image

I can't find Device Connection Service....

MilesAheadToo commented 2 years ago

Thanks. Your suggestion did help a lot.

However, large part of my Tuya devices still do not show up in HA. I have resorted to localtuya for many devices, particularly switches.

gjveld commented 2 years ago

This solved it for me too! yeah :-)

I my case updating the existing service edition was not enough though. I had to remove the API authorization from the cloud project and add it again. Then it all started working again :-)

One question and maybe feature request: I wondered why I could not see anything in my HA logs about authorization errors...

SdeGeata commented 2 years ago

This is so frustrating. "Native Tuya Integration" has ruined everything. Nothing seems to work anymore, I get some obscure message when trying to install the Tuya 2 integration.

Screen Shot 2021-10-18 at 1 56 57 PM

On the IOT platform side, I can't get past the step of scanning the QR code from my iPhone to link the app and my devices to the API. Scanning this:

Screen Shot 2021-10-18 at 1 54 28 PM

...yields this on my device:

IMG_4379

IMG_4380

"Confirm Login" does nothing. Man, I just want to run my switches from Home Assistant. How goddamn complicated do they need to make it?! It worked fine before "native integration".

PimDoos commented 2 years ago

"You cannot scan the QR code to add a device deployed in another data center" exactly explains what's wrong. You need to adjust your Cloud Project's datacenter region on iot.tuya.com. Seeing as your provider is Canadian, I would guess you need to add either (or both) Western / Eastern American Datacenter to your project. image

SdeGeata commented 2 years ago

Hello @PimDoos!

Thanks for your help. I tried both Eastern America and Western America, individually and together. All scenarios yield the same result, the same error message.

"You cannot scan the QR code to add a device deployed in another data center" exactly explains what's wrong. You need to adjust your Cloud Project's datacenter region on iot.tuya.com. Seeing as your provider is Canadian, I would guess you need to add either (or both) Western / Eastern American Datacenter to your project. image

danielbrunt57 commented 2 years ago

I am in Canada and selected Western America Data Center and successfully scanned and authorized in the app. I have one device visible in cloud and have successfully added the integration to HA but no devices are appearing. I added Eastern America Data Center to the mix but still no device. image image image image image

SdeGeata commented 2 years ago

OK! I managed to get it to work on my end. I hadn't noticed the dropdown menu on the "Link Tuya App Account" tab. The one in the upper right.

Screen Shot 2021-10-18 at 3 45 42 PM

So @PimDoos suggestion was good, I just needed to be a bit less flustered or more observent on my end... so API and App synced.

On the Home Assistant side, I was still getting issues with the Tuya-2 integration, so I opted to use LocalTuya instead - a much quicker, local option.

I got the device local_keys through the API interface, as per the directions in this YouTube video:

https://www.youtube.com/watch?v=FpY-xsY-pZ8&t=455s

Hope that helps somebody. In any case, my Tuya switches are now up and running.

PatrykMadej commented 2 years ago

image

I have same error... image

but i cant image

image

Log: 2021-10-18 23:26:59 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration tuya_v2: cannot import name 'ProjectType' from 'tuya_iot' (/usr/local/lib/python3.9/site-packages/tuya_iot/init.py)

jezzaaa commented 2 years ago

I solved the problem, the way in the pictures!

I can't find Device Connection Service....

Go to https://iot.tuya.com and login. Select "Cloud" on the left panel, then "My Services" and you should see it under "All Services":

image

danielbrunt57 commented 2 years ago

Thanks. I am subscribed to that service... image

danielbrunt57 commented 2 years ago

I ended up finding my device ID and key using codetheweb / tuyapi and went the Local Tuya route...

image