LocalTuya device unavailable

Hi,

I have multiple RGB led strips added to local tuya, but one of them’s state is “unavailable”, I am able to control thru tuya app, but no thru Home Assistant and all rgb controller are and also their versions. I don’t understand what’s causing this? Need help.

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:240
Integration: LocalTuya (documentation, issues)
First occurred: 5:20:18 AM (1 occurrences)
Last logged: 5:20:18 AM

[071...636] Connect to 192.168.13.30 failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/locks.py", line 413, 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.9/asyncio/tasks.py", line 492, in wait_for
    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/common.py", line 149, in _make_connection
    status = await self._interface.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
1 Like

A reload of the tuya device in question usually helps:

  1. Settings → Integrations → LocalTuya integration.
  2. Choose the LED strip which shows as unavailable and click on the arrow to the right.
  3. Click on the three vertical dots on the lower right.
  4. From the submenu click “Reload”.
2 Likes

Same issue, I removed all devices, uninstalled the localtuya, installed again.

Strange thing that you can control the device in question through Smart Life but not through HA. Did you by any chance reset that device lately? Because with every reset and re-pairing through the tuya app the key of the re-paired devices will change thus you have to re-run the tuya-cli wizard to get the new key to use with LocalTuya.

I even tried resetting it myself and with new local key, but it just doesn’t work with Home Assassint. I have 6 other devices with same board and firmware they work fine.

Have you tried disconnecting the LED strip from it’s power source for a couple of minutes (2-3 minutes)?
Have you completely removed that device from LocalTuya, restarted HA and re-added it again from scratch?

If so and it is still not working I am sorry to say that I am out of ideas too :confused:

PS. Does the device show up on the list of connected WLAN-devices at the router’s side?

By the way, while you are using tuya/smart life app, localtuya gets disconnected as these devices support only 1 connection.

I am using the tuya app

i mean using localtuya and tuya app simultaneously, it will break localtuya connection

I’ll delete the app and try

No no, having the app installed is not a problem, just using them simultaneously, sorry for not being clear

It’s okay, but I am not using them at the same time. State is stuck at unavailable

Let’s go hardcore now, enable debug logging for localtuya, restart your HA and share your error logs

How do I enable debug mode?

in configuration.yaml :

logger:
  logs:
    custom_components.localtuya: debug

This is what I got after enabling debug and restarting home assistant,

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:240
Integration: LocalTuya (documentation, issues)
First occurred: 2:04:11 PM (123 occurrences)
Last logged: 2:24:28 PM

[071...636] Connect to 192.168.13.30 failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/locks.py", line 413, 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.9/asyncio/tasks.py", line 492, in wait_for
    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/common.py", line 149, in _make_connection
    status = await self._interface.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

Same here. Do any body has the solution for it? As the part of the devices are not visible through the newest Tuya integration for some reasons I’d like to integrate them through LocalTuya:

This error originated from a custom integration.

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/pytuya/init.py:240
Integration: LocalTuya (documentation, issues)
First occurred: 12:30:23 AM (3 occurrences)
Last logged: 12:34:17 AM

Unexpected exception
Traceback (most recent call last):

  • File “/usr/local/lib/python3.9/asyncio/locks.py”, line 413, 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.9/asyncio/tasks.py”, line 492, in wait_for*
  • 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/config_flow.py”, line 279, in async_step_basic_info*
  • self.dps_strings = await validate_input(self.hass, user_input)*
  • File “/config/custom_components/localtuya/config_flow.py”, line 192, in validate_input*
  • detected_dps = await interface.detect_available_dps()*
  • File “/config/custom_components/localtuya/pytuya/init.py”, line 510, in detect_available_dps*
  • data = await self.status()*
  • File “/config/custom_components/localtuya/pytuya/init.py”, line 472, in status*
  • status = await self.exchange(STATUS)*
  • File “/config/custom_components/localtuya/pytuya/init.py”, line 451, in exchange*
  • msg = await self.dispatcher.wait_for(seqno)*
  • File “/config/custom_components/localtuya/pytuya/init.py”, line 240, in wait_for*
  • await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)*
  • File “/usr/local/lib/python3.9/asyncio/tasks.py”, line 494, in wait_for*
  • raise exceptions.TimeoutError() from exc*
    asyncio.exceptions.TimeoutError

I had the same thing with a lightbulb, make sure to set all the values correctly. I had to go back and forth with Tuya to get what should be what. I found I was switch color and color mode.

I am using tuya v2 now thru hacs. Everything Works fine now.

Hey manjotsc,
Just confirming you downgraded to v2 of local tuya? I am seeing some devices that are Tuya dropping off on my end - can’t seem to figure out why.

Thanks!