rospogrigio / localtuya

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

Connection to device succeeded but no datapoints found #1201

Open admiralalec opened 1 year ago

admiralalec commented 1 year ago

The problem

Device cannot be added to LocalTuya

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

Environment

Steps to reproduce

  1. Add device through LocalTuya integration
  2. Used the cloud service to automatically get localkey etc (many other devices just work)

Configuration configuration.yaml or config_flow

DP dump

{
  "result": {
    "active_time": 1662289536,
    "biz_type": 0,
    "category": "tdq",
    "create_time": 1662289536,
    "icon": "smart/solution/161001/4772fad51dca8c64_cover.png",
    "id": "",
    "ip": "",
    "lat": "",
    "local_key": "",
    "lon": "",
    "model": "2-433",
    "name": "Auto Gate Remote",
    "online": true,
    "owner_id": "",
    "product_id": "",
    "product_name": "2-433",
    "status": [
      {
        "code": "switch_1",
        "value": false
      },
      {
        "code": "switch_2",
        "value": false
      },
      {
        "code": "countdown_1",
        "value": 0
      },
      {
        "code": "countdown_2",
        "value": 0
      },
      {
        "code": "relay_status",
        "value": "0"
      },
      {
        "code": "random_time",
        "value": ""
      },
      {
        "code": "cycle_time",
        "value": ""
      },
      {
        "code": "switch_inching",
        "value": "AwACAQAC"
      }
    ],
    "sub": false,
    "time_zone": "+08:00",
    "uid": "",
    "update_time":,
    "uuid": ""
  },
  "success": true,
  "t":,
  "tid": ""
}

Provide Home Assistant taceback/logs

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:259
Integration: LocalTuya integration ([documentation](https://github.com/rospogrigio/localtuya/), [issues](https://github.com/rospogrigio/localtuya/issues))
First occurred: 23 December 2022 at 22:16:45 (6 occurrences)
Last logged: 17:16:08

[eb2...1si] Failed to get status:
[eb0...myq] 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

Additional information

jim-downie commented 1 year ago

I experienced this issue as well. Restarting Home Assistant after adding each device individually got round this problem (there may be variables not being reset after adding a device and restarting HA gets round this issue).

admiralalec commented 1 year ago

Thanks, but none of that works.

Got the same issue with Tuya Moes GU10 Led Colour Bulbs (wifi).

jim-downie commented 1 year ago

Are all your existing Tuya devices online? Once I had added an incorrectly configured device through trying to force a DPS then my only option was to remove it, restart HA and re-add it back in (something went wrong in the initialisation of the extension during startup and every device I tried to add from then on would not discover the DPS's).

admiralalec commented 1 year ago

Understand, however all other devices work and can still be added.

Border-of-the-void commented 1 year ago

I have the same problem. I tried rebooting HomeAssistant and assigned an ip address on the local network to the device. But nothing helped. Used both versions of the protocol, but got an error in both cases AddDevice

Border-of-the-void commented 1 year ago

Can anyone suggest a solution to this problem?

RACMan2527 commented 1 year ago

Hello all I'll join this collective, sharing the experience of "Connection to device succeeded but no datapoints found"

For me, I have a Tuya led spot light string

Purchased in Sep 2022. Easily setup ran well for a month on the standard Tuya (cloud) integration in HA. As I have many Tuya devices and wanted increased response time/no cloud, so I tried the Local Tuya in October. I also wanted to try the local to see if I could reduce the number of tuya device 'unavailable' I would get when the device momentary lost cloud access (??)

Removed the Tuya cloud integration and installed LocalTuya.
All tuya devices (8 total; 6 plugs, 1 fan control, LED spot string) configured without issue per the integration setup, all ran well for 2 moths. The response time was great, all but eliminated the tuya device 'unavailable', and one less cloud.
No issues.....until...

I was in the SmartLife app to setup chasing lights pattern on the LED string for the holidays (LocalTuya cannot) and noticed that the led spot string had a FW update to correct memory recall after power disconnect. As I was having occasional issue with the light turning on themselves after a brief power interruption, I update the FW. Remember all those posts that say DONT UPDATE THE FW on your devices... No more LocalTuya control for the spot led string. "Unavailable"

Spent the better part of a week dinking with the Tuya IoT platform, new IP address, device reset to gain new key, several other ill fated threads from others similar folks having setup issue.
No joy.

Finally to get my light automation back for the holiday, I reinstalled the Tuya standard integration, and disabled all devices except the spot led string...which works as expected.

I am thinking, based on the FW event prior to issue, and reading a few other threads, that the new FW went to protocol 3.4?? and said FU to HA LocalTuya. So, I have LocalTuya running 7 devices, and am forced to use the Tuya cloud integration for the spot led string after I butchered it with a FW update.

NOTE: I have purchased a replacement spot light sting. If it configures out of the box to LocalTuya, more evidence that the FW update snapped something in LocalTuya. Standby...

Some details: Localtuya version: v4.1.1 Home Assistant Core version: 2022.12.7 [] Are you using the Home Assistant Tuya Cloud component ? I am now, but NO I was only using LocalTuya [] Are you using the Tuya App in parallel ? Only infrequently. No need to use as LocalTuya integration was controlling plugs, fan and led string well. The app is not on during HA setup.

Typical Log dump: [eb1...gdl] 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

MoosJ80 commented 1 year ago

I have the same issue with a power meter. I have tried to add it with a DP which i have found using this method: https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#_9-find-your-data-point.

The entity stays unavailable.

thedfordfox commented 1 year ago

+1

Logger: homeassistant.helpers.frame Source: helpers/frame.py:77 First occurred: 6:38:09 PM (1 occurrences) Last logged: 6:38:09 PM

Detected integration that uses deprecated async_get_registry to access entity registry, use async_get instead. Please report issue to the custom integration author for localtuya using this method at custom_components/localtuya/config_flow.py, line 729: ent_reg = await er.async_get_registry(self.hass)

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: #1222 . Can you test it and provide feedback? Thank you, enjoy.

sezlony commented 1 year ago

+1

same error here as initial, I was hoping the missing v3.4 support was the problem, but now that there is, it still can't find datapoints 😢

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:450
Integration: LocalTuya integration (documentation, issues)
First occurred: 17:20:02 (7 occurrences)
Last logged: 19:35:23

[bfd...sup] 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

question: what is "manual DSP to add - used when detection is not working" good for? what parameter should I fill in?

rospogrigio commented 1 year ago

Did you try to use tinytuya with this device? Does it work?

sezlony commented 1 year ago

no way, I can't use linux for more than browsing...

barrelltitor commented 1 year ago

I have this same problem. I'm trying to move my HA to a docker container. I have two sockets added in my main HA via this component, however I cannot add them on my secondary installation.

I can add every other device, and my logs are identical to the others.

ilmisu commented 1 year ago

+1 Smart switch with no datapoints published. log:

[bff...onm] 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

any hint?