Skip to content

[tuya] Excessive looping after device is disconnected: sleepinng in polling loop should honour pollingInterval setting #21377

Description

@dilyanpalauzov

I have configured a Tuya tuyaDevice thing in openHAB 5.2.1 and I have set the logging of the binding to TRACE. The thing is configured with pollingInterval=10 (s).

When I unplug the device, the openhab logs the text below. This effectively creates endless loop, which sleeps 500ms between the iterations. The rationale for this short periods is to be able to talk to battery powered devices, for the short time when they are online. However in my case the device is not battery powered - it is either plugged in the electricity network (is online, wifi connected), or it is unplugged from the electricity network.

This endless loop with short cycles creates unnecessary high load.

  • For Tuya devices, which are not battery-powered, try reconnecting only after the time in pollingInterval is elapsed in each iteration.
2026-08-13 09:41:19.856 [DEBUG] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Connection seems to be dead.
2026-08-13 09:41:19.858 [DEBUG] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: channel closed
2026-08-13 09:41:19.860 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - bf6a44565b2bc7e4aevey9: disconnected
2026-08-13 09:41:19.863 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9: connecting
2026-08-13 09:41:20.369 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Failed to connect: connection timed out after 500 ms: 192.168.0.232:6668                                        2026-08-13 09:41:20.371 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9: connecting     
2026-08-13 09:41:20.876 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Failed to connect: connection timed out after 500 ms: 192.168.0.232:6668                                        2026-08-13 09:41:20.879 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9: connecting     
2026-08-13 09:41:21.383 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Failed to connect: connection timed out after 500 ms: 192.168.0.232:6668                                        2026-08-13 09:41:21.385 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9: connecting     
2026-08-13 09:41:21.889 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Failed to connect: connection timed out after 500 ms: 192.168.0.232:6668                                        
2026-08-13 09:41:21.891 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9: connecting
2026-08-13 09:41:22.395 [TRACE] [nding.tuya.internal.local.TuyaDevice] - bf6a44565b2bc7e4aevey9/192.168.0.232: Failed to connect: connection timed out after 500 ms: /192.168.0.232:6668

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions