rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
3k stars 565 forks source link

Connection to device succeeded but no datapoints found, please try again. #1044

Open milandzuris opened 2 years ago

milandzuris commented 2 years ago

The problem

Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:259 Integration: LocalTuya (documentation, issues) First occurred: 21:58:29 (5 occurrences) Last logged: 22:02:00

[bf4...igc] Failed to get status: [bf5...nqh] Failed to get status: Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/localtuya/pytuya/init.py", line 574, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 507, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 486, in exchange msg = await self.dispatcher.wait_for(seqno) File "/config/custom_components/localtuya/pytuya/init.py", line 259, in wait_for await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

Environment

core 9.0.4 tuya newest

koger23 commented 1 year ago

I have 3 pieces of LED controllers Mi Boxer FUT036W. All 3 were fine for a while, once 2 of 3 went offline, also lost WiFi, so I had to setup them again through Tuya Smart app. They did not work in HA after reconfiguration, so I deleted the non-working ones and keep trying to add them after each update.

When adding them I get the same error message "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.".

At the moment everything is up-to-date, also tried with protocol 3.4 (but their version is 3.3).

I will try to debug this, I have to learn the how. All I see so far: image

Anyway, there is another issue created with the same topic: #983

Update-1:

Noticed that all 3 is MiBoxer FUT036W, but product keys are the same for two which do not work according to the discovery logs:

Also log after trying to add new device:

After Enabling debug:

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:450
Integration: LocalTuya (documentation, issues)
First occurred: 7:33:19 AM (1 occurrences)
Last logged: 7:33:19 AM

[bf7...tyj] Failed to get status:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 857, in detect_available_dps
    data = await self.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 789, in status
    status = await self.exchange(DP_QUERY)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 763, in exchange
    msg = await self.dispatcher.wait_for(seqno, payload.cmd)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 450, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
coleburg commented 1 year ago

Same issue here with an UFH thermostat.

Garfius commented 1 year ago

Same issue here with 2 awning sets, only works using cloud account.

lgwapnitsky commented 1 year ago

I'm having this issue with Aegislink Smoke and CO detectors. I've rebooted a number of times, closed the SmartLife App, disabled Internet access on my IoT VLAN, still no luck. It's either no datapoints, or unknown error.

derkrasseleo commented 1 year ago

I can only recommend to everyone here to flash your devices (if possible) with firmware like tasmota, makes everything a lot easier.

lgwapnitsky commented 1 year ago

Not all devices can be flashed

derkrasseleo commented 1 year ago

Not all devices can be flashed

You're right, but many of them have ESPs (32/8266) in them, and are supported. If someone here wants to check if their device is compatible, you can search for it here: https://templates.blakadder.com/

This integration feels very messy right now and is almost harder to set up than flashing with tasmota. Also, your tuya device will probably still phone home to some cloud when using this integration (tasmota doesn't). So just saying, if your device is supported, give tasmota a try.

lukeesther commented 1 year ago

So just saying, if your device is supported, give tasmota a try.

I think most people use Localtuya because their devices cannot be flashed. Most Tuya devices from the past 2 years are not flash-able.

I'm having the same problem, yet mine is intermittent. (I have successfully set up the same device in the past but now it's failing)

lukeesther commented 1 year ago

Okay I figured it out. If I properly close the Smart Life app on my phone, it works. I think Tuya only allows one simultaneous connection through the cloud or something.

smithbill17 commented 1 year ago

I think Tuya only allows one simultaneous connection through the cloud or something.

Certainly that was previously an issue with TWO LocalTuya installs on different HomeAssistant setups - if you restarted one, the devices became available on the other & vice-versa (depending on the version of device firmware).

However, I'm not sure this is an issue with SmartLife + LocalTuya. I have SmartLife on my phone (always active) + LocalTuya on HA on pi4b + official Tuya integration on HA on pi2b. All three generally work together without any issues.

rospogrigio commented 1 year ago

Most of devices allow multiple connections, but some don't. Looks like this is your case, so you'd need to keep the SmartLife app closed.

Dvalin21 commented 1 year ago

Most of devices allow multiple connections, but some don't. Looks like this is your case, so you'd need to keep the SmartLife app closed.

Im having the same issue after getting everything backup. With that said, I closed the SmartLife App and try to add and get the same error. 2 smartbulbs and Smart plug

sibowler commented 1 year ago

@Dvalin21 - Have you tried entering in the DPIDs into the RESET field (part of device setup). I've got some devices (smart bulb, sensor light) that won't return any DPIDs until they receive the initial query via the RESET field...

Dvalin21 commented 1 year ago

@Dvalin21 - Have you tried entering in the DPIDs into the RESET field (part of device setup). I've got some devices (smart bulb, sensor light) that won't return any DPIDs until they receive the initial query via the RESET field...

What about smart plugs

sibowler commented 1 year ago

What about smart plugs

In my experience smart plugs usually expose the switch DPID without any additional configuration (usually 1 - but sometimes extra if it's something like a powerboard). However, the power sensor values don't usually get returned unless they are queried (via the RESET - aka UPDATEDPS - command). Usually these sensors are under 18, 19 and 20 DPIDs. Sometimes you also need to configure the Scan Interval, which will periodically poll these values - as some devices don't send them when they update.

Unfortunately, this RESET functionality doesn't work properly for all plugs/devices that expose some of their DPIDs automatically, but require a RESET command for the rest of the DPIDs to show up. I've fixed this issue in PR #1273 , but this would benefit from some wider testing.

andrews63 commented 1 year ago

Amendment: Worked round by setting DPIDs. All good after that.

How do you get that info and where to configure it?. I'm sorry I'm newby in this things Thanks

I managed to find the original instructions to get these into local tuya: https://community.home-assistant.io/t/tuya-local/237963/116 This contains the DPS information you need.

Go into local tuya, add a new device, fill in the name, and local key. In the second to last field, in manual DPS, enter a 1. Click submit and wait. When the box pops up, change it to light.

Now you have to fill in the DPS values. If you follow the DPS schema from the hyperlink above, the lights will work. I just did this for two separate lights and I have them in now.

Great worked for me

TapTac13 commented 1 year ago

Good evening,

so where do I begin...

I tried many ways and tbh I used every Google suggestions on the first page and because this Thread seems to me the latest, I want to share my knowledge here.

At first - I´ve managed to get my tuya devices into localtuya! (Hama Smartplugs to be exact)

The reason, why I got this error, was that I used the wrong local Key.

How do I get there?

Since the latest Version of tuya, the integration provides a possibility to get your local key with the iot.tuya site. I didn´t wanted to use the cloud development bullsh*t form tuya, so I helped my self with the "Bluestacks" Method to get my local keys. After I got them, I tried everything. From reconnecting the devices with the "Smart Life" App to reseting my Home Assistant. Nothing helped. After this I used the method, wich is here discribed and integrated the Smartplugs with the cloud method. And at this point I was curiousbecause the generated local key for my device was different from the one I was using all the time.

Long Story short. I searched the key in my xml file, which I got from Bluestacks and I truly only used the wrong key.

To test my thesis I deleted the local tuya integration, restarted hass, then installed the integration again. With the local key I used the whole time, I´ve got instant the same error message. But with the use of the other local key, the implementations was out of the box.

To help you with the search of the right local key.

The local key you watching for, is in front of the name of your device in the XML file.

It looks like this: ,"key":"860006837003*****","lat":"","localKey":"e0538d17**"**

I hope that this is the solution to this error message. In my case it worked for me.

Some additional information: Before the local integration, I got the information from iot.tuya, that my subscription is expired. After this I made a new Account with a different E-Mail Address to use the cloud integration from localtuya.

If I encounter different problems I will contribute them to you.

Greetings.

zeduperes commented 1 year ago

I have the same issue trying to add Intelbras ICA 1001

smibrandon commented 1 year ago

Same issue with several switches (but not all). Interestingly enough, this is in my development HA server only. My production server is working fine with all switches. Development server was setup from a system restore from the prod server. Let me know if I can provide anything of assistance.

koger23 commented 1 year ago

I have 3 pieces of LED controllers Mi Boxer FUT036W. All 3 were fine for a while, once 2 of 3 went offline, also lost WiFi, so I had to setup them again through Tuya Smart app. They did not work in HA after reconfiguration, so I deleted the non-working ones and keep trying to add them after each update.

When adding them I get the same error message "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.".

At the moment everything is up-to-date, also tried with protocol 3.4 (but their version is 3.3).

I will try to debug this, I have to learn the how. All I see so far: image

Anyway, there is another issue created with the same topic: #983

Update-1:

Noticed that all 3 is MiBoxer FUT036W, but product keys are the same for two which do not work according to the discovery logs:

  • (1) working: yfhxw2yk6kyhs9rp

    • Wi-Fi module: v2.0.2
    • MCU module: v1.0.0
  • (2) non-working: z5qoiz8vr18em3le

    • Wi-Fi module: v2.1.6
    • MCU module: v1.0.0 No updates available for the devices.

Also log after trying to add new device:

After Enabling debug:

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:450
Integration: LocalTuya (documentation, issues)
First occurred: 7:33:19 AM (1 occurrences)
Last logged: 7:33:19 AM

[bf7...tyj] Failed to get status:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 857, in detect_available_dps
    data = await self.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 789, in status
    status = await self.exchange(DP_QUERY)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 763, in exchange
    msg = await self.dispatcher.wait_for(seqno, payload.cmd)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 450, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

I tried again with adding DPS manually, first only with 20 as switch, then 20,22 as light, but does nto work. Entities are unavailable, so not "clickable". Currently the my tuya smart account is unlinked with iot platform and I use mobile Tuya Smart app for managing the controllers.

I don't know if it helps, but I keep trying to control my LED controllers with Node-RED and Python locally. In both cases the problem is that the LED controllers returns unexpected payload. Probably encoded, looks like encoded stuff.

I tried several libraries to try to communicate with my LED controllers, but no success. It seems it returns encoded payload, which cannot be handled by any libs I tried.

For example: this is returned by the example code with tuyaAPI (JS): image

I also tried TuyaFace and localtuya (which uses pytuya), but no break through.

Any idea what else could I try?

(there is another thead on this issue for tuyapi: https://github.com/codetheweb/tuyapi/issues/612)

haoyouandme commented 1 year ago

Hello, I'am a newby. I testing load a tuya zigbee gateway device in local tuya. But I cannot success. I never find the itemize of gateway. Please help me.

cannot find gateway in itemize

config_entry-localtuya-6457b81655481748478db10edf130758.json.txt

noesbwi commented 1 year ago

Try to set your Home Assistant network to static and fill your network configuration then save. I fix this problem with that way...

image

pillemats commented 1 year ago

Hey

Same issue here with

LSC Party Stringlight RGBIC+WW(15 Bulbs)

"Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists."

what can i do ?

wjr90 commented 1 year ago

Hey guys. After I spent many hours to solve this problem a few days ago, I found that in my case it was quite simple:

The localkey attribute of just one of my Tuya devices is VARIABLE. Every time the power goes out the key changes and I need to discover it again and update the device in the LocalTuya extension.

It was allowed to put the previous localkey, there was no connection failure, it showed this message "Connection to device succeeded but no datapoints found, please try again" but in fact the value of the localkey was already different.

I hope this can help someone.

kimme1024 commented 1 year ago

Hi All,

I'm having the weird issue that 1 of my in wall mini switches stopped working. All other 3 don't have any issues. I can control the switch via the SmartLife app.

I tried:

Any ideas?

smithbill17 commented 1 year ago

Check the versions of firmware on your working & non-working devices.

I found when I set up a 2nd Home Assistant using LocalTuya, that when I tried to add my SmartPlugs to the 2nd LocalTuya, I kept getting "no datapoints found" and so couldn't add it. If I 'restart' the 1st HomeAssistant, then while it's starting up, I can then add my SmartPlugs to the 2nd Home Assistant LocalTuya integration.

However, on SmartPlugs with older firmware, they couldn't be functional in BOTH LocalTuya's - one is greyed-out & one works. Restart the HomeAssistant with the working SmartPlugs and suddenly the greyed-out SmartPlugs in the other HomeAssistant spring to life. But this only happens with SmartPlugs with older non-upgradable firmware.

Try using the 'official' Tuya integration rather than LocalTuya.

kimme1024 commented 1 year ago

Check the versions of firmware on your working & non-working devices.

I found when I set up a 2nd Home Assistant using LocalTuya, that when I tried to add my SmartPlugs to the 2nd LocalTuya, I kept getting "no datapoints found" and so couldn't add it. If I 'restart' the 1st HomeAssistant, then while it's starting up, I can then add my SmartPlugs to the 2nd Home Assistant LocalTuya integration.

However, on SmartPlugs with older firmware, they couldn't be functional in BOTH LocalTuya's - one is greyed-out & one works. Restart the HomeAssistant with the working SmartPlugs and suddenly the greyed-out SmartPlugs in the other HomeAssistant spring to life. But this only happens with SmartPlugs with older non-upgradable firmware.

Try using the 'official' Tuya integration rather than LocalTuya.

Crapy commented 1 year ago

I get that issue when blocking the device from the internet and trying to keep it only local and restarting it, is there no way to restart devices without internet connection when using localtuya?

sibowler commented 1 year ago

Hi @Crapy - No in most instances you shouldn't need to have your devices connected to the internet to have them work. Often you need to specify the DPIDs for your device in "DPIDs to send in RESET command" parameter - this often helps tuya devices 'wake up'. But for some of my devices I have found a few additional steps necessary to allow them to work offline:

  1. Make sure that they are issued with an external DNS server via DHCP (i.e. 8.8.8.8) and then make sure connections to that server are blocked.
  2. Specify the relevant DPIDs in the RESET command - NOTE this is often not all the DPIDs, but usually the ones that don't come through unless connected to the internet. If you don't get this parameter right, the device will often stay in zombie mode. Also, this is often just DPIDs for sensors, not switches.
  3. Specify a scan interval of 30 secs
  4. Specify any remaining missing DPIDs as Manual ones - Some devices only return the DPID once it's been initialized.

The trick to telling whether a device can work offline/not connected to the internet, is by making it offline and then seeing if the Tuya app can connect/control it normally. I've got 1 device (a fan) that doesn't respond to the above technique, but even the Tuya app can't control it when offline.

Justalurker1213 commented 1 year ago

Closing out of the Tuya app fixed this error for me. My light was not allowing 2 active connections at a time.

LigerXT5 commented 1 year ago

Chiming in with my 10cents.

Had a light that stopped responding to HA via LocalTuya. Removed, readding would fail. Novestella 1300Lumen RGB Lights. I haven't found ANY DPID info on these...

I finally got it added by (make sure it's removed from HA first) restart HA as restarting/reloading LocalTuya App doesn't resolve it, then add and it went through without errors.

I checked and confirmed through the Tuya app, the light in question and others are on the same version, and I can control it through Google and Tuya before I removed it from HA.

srtxema commented 1 year ago

You won´t believe my solution. After a lot of days losted and reading forums with "no datapoints found" problem, I have solve the problem only closing tuya and smartlife apps and after it adding normally to local tuya in HA

koger23 commented 1 year ago

Lucky you :)

You won´t believe my solution. After a lot of days losted and reading forums with "no datapoints found" problem, I have solve the problem only closing tuya and smartlife apps and after it adding normally to local tuya in HA

Summary

During the last half year I read through your responses and tried some you wrote. I can confirm that the local key changes time-to-time, probably after each blackouts. I have the 4th version/change, and I can add to HA without any problems. I always have to re-register to Tuya IoT Platform with an IoT Core trial subscription and read the local keys every time and update in HA. (There is also a wierd thing that one of my controller has two presence on the network with two different device ids.)

Conclusion

So unfortunately this is the case for me. If it is broken, check local key on Tuya IoT dev platform again and update it. I hope there will be a solution for this in the future because I cannot use UPS for each controllers...

How to for new comers

  1. You need to register on Tuya IoT platform

  2. Link your mobile app to the platform

  3. Link your devices: Cloud > Development > Devices > Link Tuya App Account

  4. Note your device IDs after successful linking app and automatically the devices image

  5. Go to "Cloud > API Explorer > Device Control > Query Properties" and submit by the device IDs. image

  6. Note your local keys from the JSON result array. (result.local_key) Now you can add them to HA one-by-one.

Additionally you can also get your device DP values to help to set the values in HA: "Cloud > API Explorer > Device Management > Query Device Details in Bulk". It also returns a JSON object. image

proligde commented 1 year ago

Hi there! I just stumbled across this issue and at least in my case it seemed to be a race condition / timing issue. I had a bunch of different socket switches from different brands, all with tuya cloud integration. Two of them initially threw that Connection to device succeeded but no datapoints found, please try again. error message over and over again. While debugging the situation and retrying the same add-process multiple times, it suddenly just worked without changing anything. So before diving too deep into a red herring debugging session: retry a few times...

milandzuris commented 1 year ago

If someone need Data Points for Setup here: https://github.com/DzurisHome/Tuya-Data-Points

grishagin commented 11 months ago

Likewise, I have this issue with Lumary Smart Disk Light B1.

  1. None of them are detected automatically by Local Tuya.
  2. When trying to add a light manually, I get the dreaded error Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.
  3. When trying to add a light manually with DP IDs (discovered by tinytuya, confirmed via Tuya IoT cloud), I can add the device, but its values are all detected as -1 and the device is not controllable. Fun fact: tinytuya detects all devices and correct DPS states!
  4. This issue was raised on the HA forum here: https://community.home-assistant.io/t/need-help-configuring-lumary-lights-with-local-tuya/616003/6
grishagin commented 11 months ago

Likewise, I have this issue with Lumary Smart Disk Light B1.

1. None of them are detected automatically by Local Tuya.

2. When trying to add a light manually, I get the dreaded error
   `Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.`

3. When trying to add a light manually with DP IDs (discovered by `tinytuya`, confirmed via Tuya IoT cloud), I can add the device, but its values are all detected as `-1` and the device is not controllable.
   Fun fact: `tinytuya` detects all devices and correct DPS states!

4. This issue was raised on the HA forum here: https://community.home-assistant.io/t/need-help-configuring-lumary-lights-with-local-tuya/616003/6

I've noticed one more thing, which I believe is is the crux of the problem: these lights are on Version 3.5. I have lights of different type, Lumary Smart Ceiling Light A2, which are detected. And guess what? Those are on Version 3.3.

grishagin commented 11 months ago

Update: I found a solution that worked for me. Some gigachad @umu_ugg on HA forum created a fork of this repo that supports protocol version 3.5. It installed seamlessly on top of the original and immediately auto-detected all of my devices. Hope it helps some of y'all!

davidchezmoa commented 11 months ago

I'm a newbie on HA and Tuya devices but I got the same issue here. Also tried the suggession of @grishagin but no luck I got the same issue same logs

`2024-01-01 23:20:19.873 ERROR (MainThread) [custom_components.localtuya.core.pytuya] [bf9...vvt] Failed to get status: Traceback (most recent call last): File "/usr/lib/python3.11/asyncio/tasks.py", line 490, in wait_for return fut.result() ^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/locks.py", line 387, in acquire await fut asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/root/.homeassistant/custom_components/localtuya/core/pytuya/init.py", line 1091, in detect_available_dps data = await self.status(cid=cid) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.homeassistant/custom_components/localtuya/core/pytuya/init.py", line 1010, in status status: dict = await self.exchange(command=DP_QUERY, nodeID=cid) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.homeassistant/custom_components/localtuya/core/pytuya/init.py", line 984, in exchange msg = await self.dispatcher.wait_for(seqno, payload.cmd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.homeassistant/custom_components/localtuya/core/pytuya/init.py", line 607, in wait_for await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) File "/usr/lib/python3.11/asyncio/tasks.py", line 492, in wait_for raise exceptions.TimeoutError() from exc TimeoutError`

My device I tried to connect is a RGB light bulb.

DirkV71 commented 10 months ago

You can also determine your data points yourself and then add the device manually:

https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#_4-create-a-cloud-project

lennon101 commented 10 months ago

I think it has to do with removing the device and trying to readd it without a restart.

THIS! this was the fix for me! RESTART YOUR HA INSTANCE if you have recently removed a local tuya device and then tried to add it again

mastervol commented 9 months ago

Check the versions of firmware on your working & non-working devices.

I found when I set up a 2nd Home Assistant using LocalTuya, that when I tried to add my SmartPlugs to the 2nd LocalTuya, I kept getting "no datapoints found" and so couldn't add it. If I 'restart' the 1st HomeAssistant, then while it's starting up, I can then add my SmartPlugs to the 2nd Home Assistant LocalTuya integration.

However, on SmartPlugs with older firmware, they couldn't be functional in BOTH LocalTuya's - one is greyed-out & one works. Restart the HomeAssistant with the working SmartPlugs and suddenly the greyed-out SmartPlugs in the other HomeAssistant spring to life. But this only happens with SmartPlugs with older non-upgradable firmware.

Try using the 'official' Tuya integration rather than LocalTuya.

Thanks for the tip. I had the same problem, restarting the first home assistant instance and trying on the second instance of home assistant worked eventually. I was using 2 x hama wlan led ceiling lights.

Zebulon25 commented 9 months ago

Hi everyone,

I've the same message when I try to connect my LVWIT bulbs when I can connect without issue others devices (smart plugs, cats smart food feeders...).

When I've a look on the parameters returned by Tuya IoT Platform to find the local key, I can see that for the accepded devices, the local key is always alpanumerical when the rejected devices have a alphanumerical + special characteres keys. Could the type of key the root cause of rejected devices; Have someone be able to register devices wheit non alphanumerical key ?

Device working without issue (I've anonymized some parameters with "X"): { "result": { "active_time": 1670225425, "bind_space_id": "48039705", "category": "kg", "create_time": 1670225425, "custom_name": "bureau 1 (accessoires)", "icon": "smart/icon/1511353484_0.png", "id": "82134464c45bXXXXXXXX", "ip": "XXX.XXX.XXX.XXX", "is_online": true, "lat": "XX.0700", "local_key": "16e3cbb6b6078e4d", "lon": "XX.0800", "model": "科信嘉联KS-501", "name": "KS-501 2", "product_id": "zY4uzKMEXXXXXXXX", "product_name": "KS-501", "sub": false, "time_zone": "+01:00", "update_time": 1708879254, "uuid": "82134464c45bXXXXXXXX*" }, "success": true, "t": 1708933067665, "tid": "efe7edb5d47911eea4757adeXXXXXXXX" }

My LVWIT bulb I cannot register: { "result": { "active_time": 1684318185, "bind_space_id": "48039705", "category": "dj", "create_time": 1684318185, "custom_name": "LVWIT Smart Light basse", "icon": "smart/icon/bay1581669037386oc3n/3f260aee68825ed0635a56b1ccecb1c5.png", "id": "bfb27d476dadd0XXXXXXXX", "ip": "XXX.XXX.XXX.XXX", "is_online": true, "lat": "XX.0661", "local_key": "$pNkh>OuZg3v[+<}", "lon": "XX.0773", "model": "G45-2 WIFI DIM+CCT+RGB 5W E14 X-Y", "name": "LVWIT Smart Light", "product_id": "wwnbjdjbXXXXXXXX", "product_name": "LVWIT Smart Light", "sub": false, "time_zone": "+02:00", "update_time": 1708931199, "uuid": "35c46d0dXXXXXXXX" }, "success": true, "t": 1708932670673, "tid": "03475f87d47911eea4757adeXXXXXXXX" }

NAM1025 commented 8 months ago

What worked for me was factory resetting the device, setting it up again in the Smart Life (or the Tuya app), and then adding it to local tuya.

I factory reset it through the Tuya IoT Platform, not sure if that matters image

msrost commented 8 months ago

I'm having the same issue with 1 of 4 of my Treatlife Fan control switches. I have to use the local tuya to control in home assistant as the standard tuya integration does not allow control of both the fan speed and the light / dimmer in the same device. It was working and then for some reason got the ? on the icon in my dashboard and the fix in the past was to remove the device and add it back in. In doing so, i now get this error:

Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.

For some reason it's trying to run on 3.4 version. I'm not sure why the integration asks me what version of the protocol to use as anytime i try to change it, it goes back to 3.4. The device works fine in the SmartLife app but I want it to work in home assistant like it used to along with the other 3 that i have setup and working. This post is from 2022 and it's not 2024 and i'm surprised this is still an issue.

NAM1025 commented 8 months ago

I'm having the same issue with 1 of 4 of my Treatlife Fan control switches. I have to use the local tuya to control in home assistant as the standard tuya integration does not allow control of both the fan speed and the light / dimmer in the same device. It was working and then for some reason got the ? on the icon in my dashboard and the fix in the past was to remove the device and add it back in. In doing so, i now get this error:

Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.

For some reason it's trying to run on 3.4 version. I'm not sure why the integration asks me what version of the protocol to use as anytime i try to change it, it goes back to 3.4. The device works fine in the SmartLife app but I want it to work in home assistant like it used to along with the other 3 that i have setup and working. This post is from 2022 and it's not 2024 and i'm surprised this is still an issue.

Here's my experience/what I think is happening...

While adding a new device I had to disable my firewall rule that blocks my VLAN with all of my light switches from accessing the internet. It seems that any device that I setup 6 months - 1 year ago all of a sudden stopped working in Home Assistant. I needed to remove them from the Smart Life App, re-add it, and then go through the regular setup steps using the dev cloud (grabbing the new device id, local key, etc.)

I think either...

  1. When a device is disconnected from the cloud for X amount of time, and then reconnects, it gives it new/updated "credentials".
  2. They are intentionally updating device id and local key every so often so that you are encouraged to use their cloud services
  3. All of the above
zd3sf commented 7 months ago

Hi @Crapy - No in most instances you shouldn't need to have your devices connected to the internet to have them work. Often you need to specify the DPIDs for your device in "DPIDs to send in RESET command" parameter - this often helps tuya devices 'wake up'. But for some of my devices I have found a few additional steps necessary to allow them to work offline:

  1. Make sure that they are issued with an external DNS server via DHCP (i.e. 8.8.8.8) and then make sure connections to that server are blocked.
  2. Specify the relevant DPIDs in the RESET command - NOTE this is often not all the DPIDs, but usually the ones that don't come through unless connected to the internet. If you don't get this parameter right, the device will often stay in zombie mode. Also, this is often just DPIDs for sensors, not switches.
  3. Specify a scan interval of 30 secs
  4. Specify any remaining missing DPIDs as Manual ones - Some devices only return the DPID once it's been initialized.

The trick to telling whether a device can work offline/not connected to the internet, is by making it offline and then seeing if the Tuya app can connect/control it normally. I've got 1 device (a fan) that doesn't respond to the above technique, but even the Tuya app can't control it when offline.

Yes #2 actually worked for me. My Cree 60W tuya lights will be in zombie mode (router wan block + adguarghome DNS block), only when is set the DPID in RESET to DPID 27 or DPID 26 (i havent tried others, these worked right away).

msrost commented 7 months ago

This is absolutely infuriating. I can't control the fan speed and light through the tuya integration and I can't keep this one switch paired with the localtuya integration. I just keeps dropping off randomly and won't pair again. Sometimes it will repair if I go for days without it integrated with home assistant.

It stays connected to the smart life app and just keeps working there.

When I try to add it to home assistant I keep getting this message:

Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.

I then went to iot.tuya.com and ran the Query Properties on the device ID and got the following response:

{
  "result": {
    "properties": [
      {
        "code": "switch_fan",
        "custom_name": "",
        "dp_id": 1,
        "time": 1713399786405,
        "value": false
      },
      {
        "code": "fan_speed_enum",
        "custom_name": "",
        "dp_id": 3,
        "time": 1713399786411,
        "value": "1"
      },
      {
        "code": "bright_value",
        "custom_name": "",
        "dp_id": 6,
        "time": 1713399786451,
        "value": 100
      },
      {
        "code": "light",
        "custom_name": "",
        "dp_id": 101,
        "time": 1713399786402,
        "value": false
      },
      {
        "code": "fan_countdown",
        "custom_name": "",
        "dp_id": 102,
        "time": 1711824956212,
        "value": 0
      },
      {
        "code": "light_count_down",
        "custom_name": "",
        "dp_id": 103,
        "time": 1711824956212,
        "value": 0
      },
      {
        "code": "lowest_brightness",
        "custom_name": "",
        "dp_id": 105,
        "time": 1713399786308,
        "value": 100
      },
      {
        "code": "light_mode1",
        "custom_name": "",
        "dp_id": 106,
        "time": 1713399786426,
        "value": "mode1"
      },
      {
        "code": "wake_up",
        "custom_name": "",
        "dp_id": 107,
        "time": 1713399786463,
        "value": "AAA="
      },
      {
        "code": "indicator",
        "custom_name": "",
        "dp_id": 108,
        "time": 1713399786438,
        "value": 1
      },
      {
        "code": "random_time",
        "custom_name": "",
        "dp_id": 109,
        "time": 1713399786643,
        "value": "BgAAAA=="
      }
    ]
  },
  "success": true,
  "t": 1713399973395,
  "tid": "4330ec23fd1a11eead6aba50e5db0ba5"
}

I know the fan switch is 1, the fan speed is 3, the light switch is 101 and the light brightness is 6. I put those into the Manual DPS to add (separated by commas ',') - used when detection is not working and that didn't help.

I don't know what DPIDs to send in RESET command are, but I tried 107. Then I tried 1,3,6,101,107 and neither one did anything. The device is just not responding. Then I remove the device from Smart Life app, and re-add it back to my account and everything is working fine in Smart Life, but still can't query or control via home assistant. What do I need to do to get this thing to stay connected to my home assistant instance? I'm about ready to throw all the tuya stuff in the trash.

dombrowa commented 3 months ago

Hey guys. After I spent many hours to solve this problem a few days ago, I found that in my case it was quite simple:

The localkey attribute of just one of my Tuya devices is VARIABLE. Every time the power goes out the key changes and I need to discover it again and update the device in the LocalTuya extension.

It was allowed to put the previous localkey, there was no connection failure, it showed this message "Connection to device succeeded but no datapoints found, please try again" but in fact the value of the localkey was already different.

I hope this can help someone.

Life saver! It took me days to find this post. I had two devices, both worked, one morning one dropped off. I restarted, reconfigured, deleted it from the app/cloud, tried what-ever, reinstalled HASS and now I ran tuya-cli wizard to find out that the device's localkey changed. The message "Error when adding in Local Tuya Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists. " apparently indicates that the device/endpoint is found (local tuya can find this IP and likely connect to ist servce) but not necessarily query the device because it needs a valid key to authenticate any request. The error message is not clear IMHO.

erdnuesse commented 1 month ago

For me this message went away with different firmwares. I have 2 sets of 4 sockets; the first set wants 3.1, the other 3.3. I've also realized that my connection is most stable when the init value is set with -1 and the scan interval of 10, because my setup is without cloud / internet connectivity and so the devices stay pretty much connected all the time. Furthermore, when something breaks, for me, reconnecting with a fresh integration setup works better than trying to fix something that's broken. (be sure to have documented your IPs, IDs and keys!) My VLAN Setup has the IOT in one subnet, pinholed through a fw-rule that allows my fixed IP-HASSIO to connect to the fixed IP addresses of the IOT devices.