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

[Bug]: Zigbee sub-devices are always in an "unavailable" state. Multiple brands of human presence sensors have been used, but they all remain "unavailable." #283

Closed
2 of 3 tasks
yuanxin32323 opened this issue Jun 18, 2024 · 13 comments
Labels
bug Something isn't working stale

Comments

@yuanxin32323
Copy link

yuanxin32323 commented Jun 18, 2024

LocalTuya Version

2024.6.0

Home Assistant Version

2024.6.3

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

Zigbee sub-devices are always in an "unavailable" state. Multiple brands of human presence sensors have been used, but they all remain "unavailable."

Steps to reproduce.

image
image

Relevant log output

No response

Diagnostics information.

No response

@yuanxin32323 yuanxin32323 added the bug Something isn't working label Jun 18, 2024
@xZetsubou
Copy link
Owner

Enable the debug for the device and the integration, nothing can be done without the logs...

Copy link

github-actions bot commented Jul 3, 2024

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jul 3, 2024
@baghamut
Copy link

baghamut commented Jul 7, 2024

Have same issue with Bluetooth® Irrigation computer (bf87ce6slfcq8wpv)

Bluetooth® Irrigation computer (bf87ce6slfcq8wpv).json

config_entry-localtuya-378ca09c5026436ca75b04db41a86eaa.json

@github-actions github-actions bot removed the stale label Jul 8, 2024
Copy link

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jul 22, 2024
@Megalopole
Copy link

I've had this problem, after some updates of HA it started working. But after updating to 2024.7 it became unavailable again, it happens with all the Zigbee sensors, I can add them but not use them.
error_log-19.txt

@github-actions github-actions bot removed the stale label Jul 23, 2024
@Lurker00
Copy link

it happens with all the Zigbee sensors, I can add them but not use them.

According to the log, your gateway with address 192.168.0.122 has very unreliable connection with your router. There are only a few successful attempts to connect to it, but not for a long time. Is it WiFi gateway? Check if you can move it to a better place, or change the WiFi channel in the router settings to a less crowded.

Your "Ar Condicionado Gael" (192.168.0.102) has unreliable connection with your router as well, though better than the gateway. Consider to improve it.

after updating to 2024.7 it became unavailable again

WiFi connection problems are not related to HA versions.

@Megalopole
Copy link

Should there be no problem with SmartLife as well?

@Lurker00
Copy link

Lurker00 commented Jul 24, 2024

Should there be no problem with SmartLife as well?

I have one WiFi smart plug with weak WiFi connection. It appears to work correctly with SmartLife, but does show a similar behavior in my logs:

Example
2024-07-24 08:59:36.466 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 08:59:39.468 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 08:59:44.472 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 08:59:47.475 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 08:59:52.478 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 08:59:55.485 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:00.490 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:03.492 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:08.495 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:11.497 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:16.499 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:19.501 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:24.503 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:27.505 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:32.508 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:35.511 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:40.513 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:43.516 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:48.517 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:51.521 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:00:56.522 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:00:59.528 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:04.535 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:07.536 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:12.538 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:15.542 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:20.544 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:23.546 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:28.549 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:31.551 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:36.553 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:39.555 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:44.557 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:47.560 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:01:52.563 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:01:55.567 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:02:00.570 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:02:03.573 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Connection failed: [Errno 113] Host is unreachable ('192.168.0.50', '6668')
2024-07-24 09:02:08.575 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Trying to connect to: 192.168.0.50...
2024-07-24 09:02:09.289 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Success: connected to: 192.168.0.50
2024-07-24 09:02:09.294 INFO (MainThread) [custom_components.localtuya.coordinator] [bfd...ce8 - К: Smart plug 1G+] Reconnect succeeded on attempt: 33

The explanation is the difference between two kinds of actions:

  1. "Active": connect to the cloud to send updates of the state.
  2. "Passive": accept connections to serve an alien client.

The first task is the primary task. If a device is busy with it, and its (very small!) RAM is full of data to send, it may refuse to play the second role. E.g. when I experience problems with Internet, my wired gateway may stop working even to control local Zigbee devices, because it is busy trying to send updates to the cloud.

This plug is in the kitchen. When MW oven in use (=often status updates), it refuses connections more often. When MW oven is not used, it refuses connections much less often, I presume, when refrigerator turns its engine on and, again, there is something to let the cloud know about.

@Megalopole
Copy link

Não deveria haver problema com o SmartLife também?

Tenho um plugue inteligente WiFi com conexão WiFi fraca. Parece funcionar corretamente com o SmartLife, mas mostra um comportamento semelhante em meus logs:

Exemplo
A explicação é a diferença entre dois tipos de ações:

  1. "Ativo": conecte-se à nuvem para enviar atualizações do estado.
  2. "Passivo": aceitar conexões para atender um cliente estrangeiro.

A primeira tarefa é a tarefa primária. Se um dispositivo estiver ocupado com isso, e sua RAM (muito pequena!) estiver cheia de dados para enviar, ele pode se recusar a desempenhar a segunda função. Por exemplo, quando tenho problemas com a Internet, meu gateway com fio pode parar de funcionar até mesmo para controlar dispositivos Zigbee locais, porque ele está ocupado tentando enviar atualizações para a nuvem.

Este plugue está na cozinha. Quando o forno MW está em uso (=atualizações de status frequentes), ele recusa conexões com mais frequência. Quando o forno MW não é usado, ele recusa conexões com muito menos frequência, presumo, quando a geladeira liga seu motor e, novamente, há algo para deixar a nuvem saber.

There may be some problem with WiFi, but it's still very strange, because the device is 2 meters from the router, with no hurdle. If it had never worked I would have thought that the gateway was not compatible, but since there were a few days that it worked well, with small moments of unavailability, I can say that it is compatible.

@Lurker00
Copy link

but it's still very strange

I agree. But the matter of the fact is that the gateway either inaccessible (most of the time):

2024-07-18 08:45:16.133 WARNING (MainThread) [custom_components.localtuya.coordinator] [eb0...ukg - Porta Quarto Gael ] Connection failed: [Errno 113] Host is unreachable ('192.168.0.122', '6668')

or drops the connection:

2024-07-18 13:47:07.926 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb0...ukg - Porta Quarto Gael ] Connection lost: [Errno 104] Connection reset by peer

By the way, I see similar messages, related to WiFi or Internet connection, from non-Tuya devices:

2024-07-18 10:06:21.924 ERROR (MainThread) [homeassistant.components.broadlink.updater] Error fetching 智能遥控 (RM mini 3 at 192.168.0.115) data: [Errno -4000] Network timeout: No response received within 10s
2024-07-18 10:06:48.819 ERROR (MainThread) [homeassistant.components.broadlink.updater] Error fetching Broadlink Pro (RM pro+ at 192.168.0.106) data: [Errno -4000] Network timeout: No response received within 5s

I don't know whether it fails to connect to your devices or to the cloud.

As I said before, even with good WiFi signal, if a Tuya device can't reach the cloud, it may refuse connections.

So, if you are confident about WiFi quality, check your Internet connection in general, and connection to Tuya and Broadlink clouds.

@Megalopole
Copy link

but it's still very strange

I agree. But the matter of the fact is that the gateway either inaccessible (most of the time):

2024-07-18 08:45:16.133 WARNING (MainThread) [custom_components.localtuya.coordinator] [eb0...ukg - Porta Quarto Gael ] Connection failed: [Errno 113] Host is unreachable ('192.168.0.122', '6668')

or drops the connection:

2024-07-18 13:47:07.926 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb0...ukg - Porta Quarto Gael ] Connection lost: [Errno 104] Connection reset by peer

By the way, I see similar messages, related to WiFi or Internet connection, from non-Tuya devices:

2024-07-18 10:06:21.924 ERROR (MainThread) [homeassistant.components.broadlink.updater] Error fetching 智能遥控 (RM mini 3 at 192.168.0.115) data: [Errno -4000] Network timeout: No response received within 10s
2024-07-18 10:06:48.819 ERROR (MainThread) [homeassistant.components.broadlink.updater] Error fetching Broadlink Pro (RM pro+ at 192.168.0.106) data: [Errno -4000] Network timeout: No response received within 5s

I don't know whether it fails to connect to your devices or to the cloud.

As I said before, even with good WiFi signal, if a Tuya device can't reach the cloud, it may refuse connections.

So, if you are confident about WiFi quality, check your Internet connection in general, and connection to Tuya and Broadlink clouds.

Can you imagine any type of adjustment to be made to the router, such as port or DNS that is hindering this communication?

@Lurker00
Copy link

Can you imagine any type of adjustment to be made to the router

Sorry, I can't be in help. But I'd start with investigation of WiFi quality using "WiFi Analyzer" app and router's statistics. Here is what my old router can show:

WiFi statistics

wifi-devices

Note the noise level: a device should have its signal >20dB above the noise level for stable connection.

Here you can see that my plug (Tuya-Plug-1G): its "connected time" is only 25 hours, while other devices have it equal to the router uptime. It means, it tends to disconnect. Note the following devices:

  • Tuya-Bulb-15W: the distance from it to the router is less than 2 meters. It is just above the router! But the signal is weak, and it disconnects from LocalTuya time to time.
  • Tuya-GW003 is a wireless gateway, 6 meters and two concrete walls between it and the router's antenna, but its connection is more stable than Tuya-Bulb-15W (72 Mbps vs 58 Mbps). Yet it may disconnect for a moment.
  • Tuya-Plug-HA and Tuya-Plug-USB are in < 2 meters and one concrete wall, but they have horizontal orientation. The signal level is very good, but the speed is only 65 Mbps out of 72 Mbps. Nevertheless, they still feel better than Tuya-Bulb-15W: never saw problems with them!

It proves that the distance by itself does not really matter for the signal! In fact, relative antennas orientation is the main factor. Of course, after obstacles that prevent radio waves to come through, and how noisy the WiFi channel is.

Good luck!

Copy link

github-actions bot commented Aug 9, 2024

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

5 participants