Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection to device succeeded but no datapoints found, #1468

Closed
lcsneil opened this issue Jul 29, 2023 · 20 comments
Closed

Connection to device succeeded but no datapoints found, #1468

lcsneil opened this issue Jul 29, 2023 · 20 comments
Labels
bug Something isn't working

Comments

@lcsneil
Copy link

lcsneil commented Jul 29, 2023

Tuya Clamp Power Meter PJ-MGW1103

The problem

Device connects fine to Tuya Cloud and works with the phone app no issues. Try to then configure it on localtuya.
The device is found and I have put in the parameters from the web account and get error that device is found but no data points.

Environment

Using Version 5.2.1 (have also tried 5.0.0 with same results)

HA running on RPi4

  • Localtuya version: 5.2.1
  • Home Assistant Core version:
  • [] Does the device work using the Home Assistant Tuya Cloud component ? X
  • [] Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool ?
  • [] Was the device working with earlier versions of localtuya ? Which one?
  • [] Are you using the Tuya/SmartLife App in parallel ? X

DP dump

Provide Home Assistant traceback/logs

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:450
Integration: LocalTuya integration ([documentation](https://github.com/rospogrigio/localtuya/), [issues](https://github.com/rospogrigio/localtuya/issues))
First occurred: 07:47:41 (1 occurrences)
Last logged: 07:47:41

[bf9...9hp] Failed to get status:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/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 "/config/custom_components/localtuya/pytuya/__init__.py", line 863, in detect_available_dps
    data = await self.status()
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 795, in status
    status = await self.exchange(DP_QUERY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 769, 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.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Additional information

localTuya

@lcsneil lcsneil added the bug Something isn't working label Jul 29, 2023
@e3drigs
Copy link

e3drigs commented Jul 31, 2023

Sharing this problem trying to set up localtuya for first time today.
HA 2023.7.3
localTuya 5.2.1

Attempting to add heaters and bulbs both yield same message and stack trace.

@gh69
Copy link

gh69 commented Aug 4, 2023

I have had this same issue for nearly a year now on multiple versions. I'm currently using HA core 2023.7.3 and the latest HACS localTuya version and I just tried getting it to work again (since my free year of Tuya cloud is almost up) but I am still seeing the same problem. I only have 1 Tuya compatible device on my account and on my network. It is a pet feeder, which has a "Tuya Scene" (this toggles the feeder switch) and a security camera. These show up as 2 separate devices on the regular cloud based Tuya integration but they both work perfectly there. I have not been able to get anything to work on Local Tuya. i've got the device id and the looked-up local_key but when I attempt to add the device using protocol version 3.3, I immediately get the error "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists." If I attempt to add the device with protocol version 3.4, it spins there for a minute before coming back with that same error.

@gootr00
Copy link

gootr00 commented Aug 4, 2023

I have the sam problem. I cannot get the camera's in homeassistant tuya nor localtuya.

@gh69
Copy link

gh69 commented Aug 4, 2023

I actually have no problems with the camera using the regular cloud-based tuya integration. With the cloud-based tuya integration the cam shows up as a sensor and all of it's extras show up as configuration controls (flip [switch], motion alarm [switch], motion detection sensitivity [drop down list], motion recording [switch], record mode [drop down list], video recording [switch]) and they all work great. The localtuya integration is where I'm seeing the no-datapoints-found error and this is preventing me from using the camera and replacing the cloud-based tuya integration with the localtuya integration.

I'm curious, gootr00, do you see this same error with the cloud-based tuya integration as well?

@Justmeagene
Copy link

Same here cloud-based tuya works but got the same error as lcsneil in the local tuya

hope its fixet soon

@imadegunawinangun
Copy link

Im facing same issue

@shazn786
Copy link

i am also getting this same error while trying to add a breaker with energy monitor feature, whereas i am using 7 other on/off switches with energy monitor (the switches work fine while also giving me readings regarding current, voltage and watts usage)

config_entry-localtuya-0f4d0723e6185c802cc31923261f5da4.json.txt

localtuya-0f4d0723e6185c802cc31923261f5da4-Mains Breaker-EM-1141bd2eb8eaf4a4c7747b146b792e97.json.txt

@meierthomas
Copy link

While local-tuya works fine for me for my Wifi smart dimmers I have the same issues reported here when trying to add an outdoor RGB LED; i.e.

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

Log file of the process of adding the RGB LED
home-assistant_localtuya_2023-08-13T01-44-40.548Z.log

I can add the device in the Tuya Smart app and it works fine. When adding it to Home Assistant I get the above error.

Did a bit more digging around datapoints. I have used the method described by Jimmy James (https://www.youtube.com/watch?v=Q1ZShFJDvE0&t=372s) to find the keys. In the referenced time stamp he also shows how to check the info on data points from the IOT cloud service. I have done the same with the RGB light and I don't get a dp_id: value as shown in the video from Jimmy James; i.e.

image

What I get from my light is the following specs; you see that dp_id is missing from my RGB LED

image

So I wonder whether there's a firmware issue or a setting to make this available...

@Milliamper
Copy link

Same issue here too with PJ-1103 WiFi Digital Meter

  • I have tried Local Tuya integration, with and without Cloud API
  • I also tried downloading and using the Local Tuya master branch
  • The Tuya integration shows that "WiFi Digital Meter (unsupported)", so it doesn't list any entities
  • And I also renewed my subscription to Tuya IoT
  • And many-many restarts and Local Tuya reinstallations

@shazn786
Copy link

shazn786 commented Aug 16, 2023 via email

@gh69
Copy link

gh69 commented Aug 16, 2023

Just so there's no confusion...the problem technically isn't resolved, as the "no datapoints found" issue is with LocalTuya. The standard Tuya integration does work for many of us but it requires that cloud connection, which is what LocalTuya helps us get away from.

@shazn786
Copy link

shazn786 commented Aug 16, 2023 via email

@deimosfr
Copy link

I'm geting the same issues :(

@xZetsubou
Copy link

xZetsubou commented Aug 17, 2023

There are 2 main reason that can cause this error, as far that I know

  1. That you chose the wrong protocol version.
  2. The device is busy due to another client connected and using the device, e.g [ Tuya app, smart life app and other local integration ] Don't remove them just close those apps you need to make sure to the device you are trying to set it up isn't used by any other client also isn't used locally in another HA instance.

Some said restart router or HA can fix this issue is probably because by restarting those u probably disconnected the client that connected to the device.

@meierthomas
Copy link

Just a quick update that I was able to successfully add the device via Tuya Local. I know this doesn't really address why it's not working in LocalTuya but at least there's a workaround. I'm also impressed that both integrations can coexist (i.e. Tuya Local and LocalTuya)

@lcsneil
Copy link
Author

lcsneil commented Aug 19, 2023

There are 2 main reason that can cause this error, as far that I know

  1. That you chose the wrong protocol version.
  2. The device is busy due to another client connected and using the device, e.g [ Tuya app, smart life app and other local integration ] Don't remove them just close those apps you need to make sure to the device you are trying to set it up isn't used by any other client also isn't used locally in another HA instance.

Some said restart router or HA can fix this issue is probably because by restarting those u probably disconnected the client that connected to the device.

I can't be sure enough I haven't used this repo since months I use my fork tho I haven't modify pytuya yet.

Tried removing localtuya, rebooting, installed xZetsubou' fork reboot and and got exactly the same issue (with all 4 protocol versions). No datapoints found.

lcsneil

@lcsneil
Copy link
Author

lcsneil commented Aug 20, 2023

Ok - I have solved it for me. End user error. Given that others sound like they have the same symptoms I will embarrass myself by admitting what I did wrong. Basically RTFM!

I was using the 'secret' key on the Tuya cloud account, as the local key. This is NOT the one you need for the local key. That you find as per the instructions. Using that cloud key as the local one gives you device found but no data points as per my original problem.

As the installations instructions say...
Under "Devices Management", select the "Query Device Details in Bulk" function, and enter your Device IDs, separated by commas. In the results you should see your local_key.

Off to hang my head in shame ........

lcsneil

@lcsneil lcsneil closed this as completed Aug 20, 2023
@martinvana
Copy link

Adding to the mix - in case someone else may benefit:
I was scratching my head for a while for the exactly same reason. In my case the integration pre-filled the Local key so I didn't doubt it.
However, rebooting the entire HomeAssistant yielded a different Local key and that fixed the issue. :-)

@rgnyldz
Copy link

rgnyldz commented May 3, 2024

I get this error message with 5.2.1 and Local key, ip address of the device, user id etc are all set up correctly.

Tho in my old home assistant instance where I use 3.2.4.2 with the protocol version 3.5 everything is working fine. in 5.2.1 there is no 3.5 protocol version.

Below is my log;

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:863
integration: LocalTuya (documentation, issues)
First occurred: 2:30:06 AM (1 occurrences)
Last logged: 2:30:06 AM

[bfe...y6p] Failed to get status:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, in acquire
    await fut
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 863, in detect_available_dps
    data = await self.status()
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 795, in status
    status = await self.exchange(DP_QUERY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 769, 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.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

@JSferry
Copy link

JSferry commented May 26, 2024

Stò provando a configurare la centralina RainPoint TTV103FRF_wifi con localTuya ma ricevo anche io lo stesso errore:

La connessione al dispositivo è riuscita ma non sono stati trovati i datapoint, riprova. Crea un nuovo Issue e includi i log di debug se il problema persiste.

Quello che ho potuto notare è che il configuratore di localTuya trova solo l'HUB connesso alla rete.
Non posso aggiungere ne la valvola ne la presa perchè la loro local_key è vuota, l'unico ad averla è l' HUB.

Effettuando un controllo attraverso il pannello sviluppatore di Tuya IoT Platform, rispettivamente in Cloud > Development > My Project > Devices è possibile notare che l'HUB non ha nessun DP instruction, mentre la Valvola di controllo dell'acqua (Water valve controller) e la Presa (Socket)" si, ma senza local_key non riesco ad aggiungerle.

Qualcuno si trova nella mia stessa situazione ed è riuscito ad ovviare al problema in qualche modo??

Di seguito il debug dell'errore:

Questo errore ha avuto origine da un'integrazione personalizzata.

Registratore: custom_components.localtuya.pytuya
Fonte: custom_components/localtuya/pytuya/__init__.py:863
Integrazione: LocalTuya (documentazione, problemi)
Prima occorrenza: 17:55:08 (1 occorrenze)
Ultima registrazione: 17:55:08

[bfb...tma] Failed to get status: could not decrypt data: wrong local_key? (exception: Expecting value: line 1 column 1 (char 0))
Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 953, in _decode_payload
    json_payload = json.loads(payload)
                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 863, in detect_available_dps
    data = await self.status()
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 795, in status
    status = await self.exchange(DP_QUERY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 780, in exchange
    payload = self._decode_payload(msg.payload)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 955, in _decode_payload
    raise DecodeError(
custom_components.localtuya.pytuya.DecodeError: could not decrypt data: wrong local_key? (exception: Expecting value: line 1 column 1 (char 0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests