Skip to content

Comments

[tuya] Avoid refresh if there are no measurables#19930

Merged
lsiepel merged 3 commits intoopenhab:mainfrom
mjagdis:smartRefresh
Jan 2, 2026
Merged

[tuya] Avoid refresh if there are no measurables#19930
lsiepel merged 3 commits intoopenhab:mainfrom
mjagdis:smartRefresh

Conversation

@mjagdis
Copy link
Contributor

@mjagdis mjagdis commented Dec 31, 2025

If all the DPs are functions asking the device to refresh measured values is pointless. Some devices return a null result for DP_REFRESH, some just ignore it entirely. Ignoring it causes a timeout which leads to the binding reconnecting - over and over and over...

Fixes #19880

Signed-off-by: Mike Jagdis <mjagdis@eris-associates.co.uk>
@mjagdis mjagdis requested a review from J-N-K as a code owner December 31, 2025 14:46
@lsiepel lsiepel requested a review from Copilot December 31, 2025 21:03
@lsiepel lsiepel added the bug An unexpected problem or unintended behavior of an add-on label Dec 31, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to disable polling when a Tuya device has only function DPs (commands) and no measurable DPs (status/sensors), as polling such devices is pointless and can cause connection issues. The change adds logic in the initialize() method to check for the presence of measurable DPs and disables polling by setting pollingInterval to 0 when none are found.

Key changes:

  • Adds detection logic to identify whether any measurable DPs exist in the device schema
  • Automatically disables polling when no measurables are present
  • Logs when polling is disabled due to lack of measurables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mjagdis and others added 2 commits January 2, 2026 14:25
…ding/tuya/internal/handler/TuyaDeviceHandler.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: mjagdis <mjagdis@eris-associates.co.uk>
…ding/tuya/internal/handler/TuyaDeviceHandler.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: mjagdis <mjagdis@eris-associates.co.uk>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lsiepel lsiepel merged commit 090b010 into openhab:main Jan 2, 2026
2 checks passed
@lsiepel lsiepel added this to the 5.2 milestone Jan 2, 2026
lsiepel pushed a commit that referenced this pull request Jan 2, 2026
* [tuya] Avoid refresh if there are no measurables

Signed-off-by: Mike Jagdis <mjagdis@eris-associates.co.uk>
@lsiepel lsiepel added the backported A PR that has been cherry-picked to a patch release branch label Jan 2, 2026
@san4esmc
Copy link
Contributor

san4esmc commented Jan 8, 2026

Hi!
I see that this was cherry-picked to 5.1.x branch. I built that one, but, unfortunately, after bundle update I still see cycling in logs:

11:31:36.022 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:36.107 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:37.029 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:37.116 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:39.058 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:39.156 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:40.076 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:40.165 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:40.236 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:bedroom_2_bathroom_cabinet_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:42.107 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:42.205 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:43.114 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:43.213 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE: Waiting for device wake up to ONLINE
11:31:45.156 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_island_led' changed from ONLINE to ONLINE: Waiting for device wake up
11:31:45.253 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:kitchen_sink_led' changed from ONLINE to ONLINE: Waiting for device wake up

Also when I install jar with reverted #19530 provided in this comment #19880 (comment) this cycling stops.
As I understand revertion is not a correct "fix", but looks like this fix is not full yet 😞

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/tuya-devices-constantly-toggle-between-online-and-online-waiting-for-device-wake-up-after-update-to-openhab-5-1-0/167627/27

@lsiepel
Copy link
Contributor

lsiepel commented Jan 8, 2026

fyi @mjagdis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported A PR that has been cherry-picked to a patch release branch bug An unexpected problem or unintended behavior of an add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tuya] Constant status cycling ONLINE ↔ "Waiting for device wake up" in 5.1.0 for mains-powered devices

4 participants