rospogrigio / localtuya

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

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

Open Mr-Chip opened 1 year ago

Mr-Chip commented 1 year ago

The problem

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

DP dump

Provide Home Assistant taceback/logs

Additional information

Mr-Chip commented 1 year ago

Localtuya Version: V4.1.1 Last Working Tuya Version: ? HomeAssistant Core Version: 2022.10.5 Are you using Home Assistant Tuya Cloud Component? No Are you using the Tuya App in parallel: No

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

The issue appears to be with this device:

{ "result": { "active_time": 1667207445, "category": "dj", "category_name": "Light Source", "create_time": 1665707994, "gateway_id": "", "icon": "smart/icon/ay15045037991144sZ1c/98e177ffc7206a864ff10980106cb639.png", "id": "xxxxxxxxxxxxxxxxxxxxxx", "ip": "104.129.198.138", "lat": "33.9977", "local_key": "xxxxxxxxxxxxxxxx", "lon": "-117.9149", "model": "", "name": "Family Room LED_2", "online": true, "owner_id": "10598008", "product_id": "kfuh8lxha2sn6iuq", "product_name": "LED Downlight", "sub": false, "time_zone": "-07:00", "update_time": 1667207449, "uuid": "xxxxxxxxxxxxxxxx" }, "success": true, "t": 1667208279475, "tid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }

bennyb0i commented 1 year ago

This error kept happening to me as well, recently, when trying to add new Tuya smart plugs (although it only happened to certain devices, not all).

I discovered the workaround that allowed me to get past this error and correctly set up the device was to open the device in the Tuya app on my phone and perform the add in Local Tuya while the app was still open on my phone. In my case I opened the power meter section of the device in the app, but it might work similarly for lights and other devices.

A restart of Home Assistant then solved any resulting zombie modes for the devices after I registered them this way.

Worth a try in your case?

Nerwyn commented 1 year ago

I have the same error when trying to add Dogain E12 bulbs. I've tried setting them up with the app open and stopped, the IoT website opened and logged out, and the HA Tuya integration disabled and enabled (the HA Tuya works but I refuse to be stuck with cloud only devices and will return them if I can't get them working locally). I always get the error in the title and the following one in the logs:

2022-11-13 21:44:06.976 ERROR (MainThread) [custom_components.localtuya.pytuya] [eb9...ssl] 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
indothai commented 1 year ago

Hi, Fixed my problem that had the same error message. Hope the following will help. I found out that the local_key has been changed. Found this out by going to tuya.com and going into the "Get Device Information" and entering the device_id. After I applied the new local_key, I'm able to add the device and view the information normally.

NeoFax75 commented 1 year ago

I received the same error and the following error when adding lights and Motion Sensors:

Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 580, in async_step_configure_device self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 245, in validate_input interface = await pytuya.connect( File "/config/custom_components/localtuya/pytuya/__init__.py", line 704, in connect _, protocol = await loop.create_connection( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection raise exceptions[0] File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect return await fut File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.1.173', 6668)