Refresh/polling of non visible elements

Does Refresh/polling keep happening at the same frequency on elements when IsVisible is set to NO?

If so, can the refresh switch or the frequency be manipulated programmatically so non-visible elements don’t tax the system or network unnecessarily?

It depends on the device. Many of the Home Remote’s device integrations are event based & not polled. In these cases it doesn’t really matter since the changes are sent as they occur (the app doesn’t need to poll for state changes). There are still several integrations that do use standard HTTP polling & some do indeed check before sending a status request. A new HasSubscribers field that was recently added to the Device object. This is a boolean that indicates whether the device is actively displayed on any views. Some of the newer integrations look at the connection’s Devices to see if this field has been set on any of them before sending a request. This is currently an internal field that isn’t accessible to user plugins. I’ll try to make this accessible in a future release.

If this is for a Plugin you’ve written, I recommend checking to see if your device supports an event based protocol like MQTT, TCP, or WebSockets. Most of these protocols will broadcast the changes when they happen which alleviates the need for polling. The “receive” & "readMessage’’ functions on those libraries are blocking calls, which means the system will sit & wait until data is available. Therefore not taxing any network resources or CPU usage. I know for many devices you don’t always have this option, so like I said, I do plan on making this new HasSubscribers field available to user Plugins as well.

Following. Please announce when this is done, I would love to use this feature!

This was added in the 3.9 release.

2 Likes

This is very good news. Much thanks for this update.
With it, one can put network-intensive plugins inside popups, and only have them run while the display element is visible.
:+1: