If I create a RESTful sensor fetching data from external API endpoint, how is the refresh frequency controlled? I’ve tried this:
- platform: rest
scan_interval: 15
....
But regardless of the value (or no value at all) I can’t get the sensor to update automatically, it just stays as is until I refresh manually. https://www.home-assistant.io/integrations/rest does not list anything on refresh frequency, but https://www.home-assistant.io/docs/configuration/platform_options/ does mention scan_interval, although as mentioned, it has no effect. Plus it states “These options are being phased out and are only available for single platform integrations.”
Right, that makes sense. However, once information changes - and since this is a pull activity - what determines how often the sensor will poll for updates?
That is the problem with polling.
Worst case you could have the “wrong” state scan_interval minus one second if the value updated just after you polled.
I’m still looking for tips here. I have set up a restful sensor and it’s hitting the rest endpoint like 100 times each hour, which is far too often and I’m getting complaints and unnecessarily reaching bandwitdh limits that prevent the sensor from working constantly. So I would like an option to limit the sensor to only poll once every n minutes or something similar.