[tuya] Avoid refresh if there are no measurables#19930
Conversation
Signed-off-by: Mike Jagdis <mjagdis@eris-associates.co.uk>
There was a problem hiding this comment.
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.
....binding.tuya/src/main/java/org/openhab/binding/tuya/internal/handler/TuyaDeviceHandler.java
Outdated
Show resolved
Hide resolved
....binding.tuya/src/main/java/org/openhab/binding/tuya/internal/handler/TuyaDeviceHandler.java
Outdated
Show resolved
Hide resolved
....binding.tuya/src/main/java/org/openhab/binding/tuya/internal/handler/TuyaDeviceHandler.java
Outdated
Show resolved
Hide resolved
…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>
* [tuya] Avoid refresh if there are no measurables Signed-off-by: Mike Jagdis <mjagdis@eris-associates.co.uk>
|
Hi! Also when I install jar with reverted #19530 provided in this comment #19880 (comment) this cycling stops. |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
|
fyi @mjagdis |
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