rospogrigio / localtuya

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

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

Open redlingg opened 2 years ago

redlingg commented 2 years ago

Hello What does this mean? I reinstalled local tuya and since then I am not able to add the devices. thanks

1mseba commented 2 years ago

I have the same, only does anyone support this project?

SergeantPup commented 2 years ago

I received the same when adding devices I already had added to another instance of HA and Local Tuya. They are the atomi string lights. I cannot add these lights to Local Tuya anymore.

SergeantPup commented 2 years ago

To confirm this isn't me, I copied the settings directly from the edit screen in my older/established instance and pasted them into the newer version and I got the same results as above. Something has definitely changed where it's not allowing these devices to establish the connection now.

SergeantPup commented 2 years ago

You can force it through it you play with the DPS's. I got the settings to expose on the next screen and they're pretty close to what I need, but I couldn't quite make it work. I'm sure if I try every combination, I'll eventually get it. I'm copying the settings from my old HA instance.

kevvar commented 2 years ago

You can force it through it you play with the DPS's. I got the settings to expose on the next screen and they're pretty close to what I need, but I couldn't quite make it work. I'm sure if I try every combination, I'll eventually get it. I'm copying the settings from my old HA instance.

Did you get it work??

redlingg commented 2 years ago

not yet…. :( What is the DPS???

Az iPademről küldve

  1. szept. 26. dátummal, 6:51 időpontban kevvar @.***> írta:

 You can force it through it you play with the DPS's. I got the settings to expose on the next screen and they're pretty close to what I need, but I couldn't quite make it work. I'm sure if I try every combination, I'll eventually get it. I'm copying the settings from my old HA instance.

Did you get it work??

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

kevvar commented 2 years ago

not yet…. :( What is the DPS??? Az iPademről küldve

  1. szept. 26. dátummal, 6:51 időpontban kevvar @.***> írta:  You can force it through it you play with the DPS's. I got the settings to expose on the next screen and they're pretty close to what I need, but I couldn't quite make it work. I'm sure if I try every combination, I'll eventually get it. I'm copying the settings from my old HA instance. Did you get it work?? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

A guy made it work in this thread I'm waiting his response, maybe you can follow it

iosoft commented 2 years ago

I am also facing the same issue after I bought a brand new simple wifi switch.

From SmartLife App, it is working fine. But, when I try to add it in HA+localTuya, it is giving me this error -

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

Tested with both 3.1 and 3.3 Protocols but no success.

I found this Error Log entry -

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:259 Integration: LocalTuya (documentation, issues) First occurred: 1:11:40 PM (4 occurrences) Last logged: 1:13:23 PM

[d78...jry] 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

Please suggest how to fix this stupid issue. Thanks and regards

balbulator commented 2 years ago

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

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:259 Integration: LocalTuya integration (documentation, issues) First occurred: 21 жовтня 2022 р. о 23:56:44 (3 occurrences) Last logged: 00:16:19

[638...ad0] 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

jim-downie commented 1 year ago

I experienced the same issue. Only way to add devices cleanly was to restart HA after each device is added. This may be down to variables not being reset between adding devices (restarting HA ensures everything is torn down).

rospogrigio commented 1 year ago

Some of these devices might not work because they are using the 3.4 protocol. I have now published a PR that provides support for 3.4: https://github.com/rospogrigio/localtuya/pull/1222 . Can you test it and provide feedback? Thank you, enjoy.

kevvar commented 1 year ago

Some of these devices might not work because they are using the 3.4 protocol. I have now published a PR that provides support for 3.4: #1222 . Can you test it and provide feedback? Thank you, enjoy.

Greate news @rospogrigio, how can I try it? just downloading the add-on?

rospogrigio commented 1 year ago

Well there are several ways to do it, the simplest is to just download the pytuya/__init__.py file you find in the PR and replace the one you find in your installation, then restart HA of course.

kevvar commented 1 year ago

Thanks @rospogrigio I'll try it, and provide some feedback

kevvar commented 1 year ago

Well there are several ways to do it, the simplest is to just download the pytuya/__init__.py file you find in the PR and replace the one you find in your installation, then restart HA of course.

I replaced the file pytuya/__init__.py in my HA instance, restart, but doesn't show the 3.4 protocol. Maybe I did something wrong? image

kevvar commented 1 year ago

My bad @rospogrigio I did not replace the localtuya/config_flow.py. Once the file was replaced I can see the new protocol: image I'm configuring my devices, I got the DPS without issues.

EDIT: All my tuya switches are working @rospogrigio thanks buddy your work is amazing. Blessings

rospogrigio commented 1 year ago

Yes, sorry I forgot that also config_flow.py had changed. Let me know how it goes...

kevvar commented 1 year ago

Yes, sorry I forgot that also config_flow.py had changed. Let me know how it goes...

Sure @rospogrigio I edited my last comment. All my switches are working!! thanks a lot!!

dimyard commented 1 year ago

Wow! It works! @rospogrigio thanks!

1mseba commented 1 year ago

After changing the files: _localtuya/configflow.py pytuya/`init.py` I have the following:

_``` Logger: homeassistant.loader Source: custom_components/localtuya/common.py:26 Integration: LocalTuya integration (documentation, issues) First occurred: 21:36:09 (1 occurrences) Last logged: 21:36:09

Unexpected exception importing component custom_components.localtuya
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 725, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/localtuya/__init__.py", line 31, in <module>
    from .common import TuyaDevice, async_config_entry_by_device_id
  File "/config/custom_components/localtuya/common.py", line 26, in <module>
    from . import pytuya
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 71
    <title>localtuya/__init__.py at protocol_3.4 · rospogrigio/localtuya · GitHub</title>
                                             ^

SyntaxError: invalid character '·' (U+00B7)

Logger: homeassistant.setup Source: setup.py:210 First occurred: 21:36:09 (1 occurrences) Last logged: 21:36:09

Setup failed for custom integration localtuya: Unable to import component: Exception importing custom_components.localtuya



What am I doing wrong ?
kevvar commented 1 year ago

After changing the files: _localtuya/configflow.py pytuya/init.py

Maybe the file name? The correct one is __init__.py, take care of the underscore lines

1mseba commented 1 year ago

Sure, I changed the underscore file "__init__.py". The browser must have changed something while saving.

After changing back HA shows no errors.

milandzuris commented 1 year ago

@rospogrigio image image

kevvar commented 1 year ago

@milandzuris did you change the 2 files? pytuya/__init__.py localtuya/config_flow.py

milandzuris commented 1 year ago

@milandzuriszmenil si 2 súbory? pytuya/__init__.py localtuya/config_flow.py

yes

rospogrigio commented 1 year ago

@milandzuris screenshots are not useful at all, you need to provide debug messages to allow me to understand what's going wrong.

kevvar commented 1 year ago

@milandzuriszmenil si 2 súbory? pytuya/__init__.py localtuya/config_flow.py

yes

Check the files code with the code on the pull request, maybe there are differences, when I downloaded the files the browser did a weird thing and changed the code in the files, so I had to copy and paste the code manually

milandzuris commented 1 year ago

@milandzurissnímky obrazovky nie sú vôbec užitočné, musíte poskytnúť ladiace správy, aby som pochopil, čo sa deje.

This error originated from a custom integration.

Logger: homeassistant.loader Source: custom_components/localtuya/common.py:26 Integration: LocalTuya (documentation, issues) First occurred: 22:37:19 (1 occurrences) Last logged: 22:37:19

Unexpected exception importing component custom_components.localtuya Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 725, in get_component cache[self.domain] = importlib.import_module(self.pkg_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/localtuya/init.py", line 31, in from .common import TuyaDevice, async_config_entry_by_device_id File "/config/custom_components/localtuya/common.py", line 26, in from . import pytuya File "/config/custom_components/localtuya/pytuya/init.py", line 2

                     ^^

SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

milandzuris commented 1 year ago

fixed, thx for work @rospogrigio

rospogrigio commented 1 year ago

Glad to read that @milandzuris . Just for other people who might end in the same situation, what was your problem and how did you solve it? Thank you for your feedback.

milandzuris commented 1 year ago

Glad to read that @milandzuris . Just for other people who might end in the same situation, what was your problem and how did you solve it? Thank you for your feedback.

copy code from github and edit file in vscode

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

sarunasr commented 12 months ago

The same for me, I'm trying to integrate temperature sensor TH01CB3S.

milandzuris commented 12 months ago

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

srtxema commented 11 months ago

very interesting. Thanks!

shorvit commented 4 months ago

Thank you Chema and Dzuris, after putting 1 and 1 into DP fields and also closing Smartlife app in my phone, my switch was finally linked into Home Assistant - local Tuya integration. Not sure which of the solutions worked though :)