I have added a system health tab on my raspbian with the use of the systemmonitor all is working like a charm, I am finally getting the hang of yaml and all its pros and cons however, there is no information on the sysmonitor page that tells me how often these sensors are refreshing. So basically I look at values like the cpu load, but I have no idea how old it is. Is there any way I can manipulate how often they update?
scan_interval is not listed as a valid option in the documentation.
I looked through the source code and discovered it uses the psutil library.
However, I canāt find anything in the componentās code referring to polling so I donāt how it refreshes its data.
I also read how to use psutil to get cpu_percent. It says if you use interval=None it will report āsystem CPU times elapsed since last call or module import, returning immediatelyā. If you check the code, thatās precisely how the component gets cpu_percent.
The mystery to me is what constitutes the last call? The last time you looked at the value in the UI?? It remains unclear to me how often it performs ācallsā to update itself.
I agree, Iām not fully sure how the insides of Home-Assistant work yet, but I donāt see anything in the componentās code that would update its data.
In that case, would it fall back to the default 30 second scan interval from homeassistant/components/sensor/__init__.py ?
It is. All platforms which are polling can overwrite it. But you should know what you are doing.
The general issue is that we wonāt want people to fine tune the polling interval on a large scale. This leads to performance issues on low-powered hardware, often just doesnāt make sense to get a measurement every second and is filling the database.
Thanks! I didnāt realize there was a documentation base class that platform docs inherit from!
Iāve always considered the component/platformās documentation as its master reference and didnāt know about that specific doc page which defines two, broadly applicable, options (entity_namespace and scan_interval).
I guess this solves the mystery of the systemmonitorās default polling period (30 seconds).
BTW, the doc page you mentioned contains the following note:
These options are being phased out and are only available for single platform integrations.
According to my tests, the default scan_interval is 15 sec - at least for the processor_use sensor.
May be for other sensors the frequency is different.
Am I right?
What are values/value of frequency for sensors?
The history-graph card shows data āas isā - every sensorās update.
The mini-graph-card splits the whole time period (hours_to_show) to small intervals; number of intervals (points_per_hour) defines accuracy.
The 2nd mini-graph-card has a smaller points_per_hour value = 240 (freq 15 sec):
the graph has more curves;
the graphās curves are NOT changing - just new curves are added.
The 1st mini-graph-card has a smaller points_per_hour value = 120 (freq 30 sec):
the graph has less curves;
the graphās curves ARE changing - old curves are changing every 30 sec.
So I concluded that at least for the processor_use sensor the scan_interval = 15 sec.
Also I found that for network_in, network_out the scan_interval = 30 sec.
Surely I could make mistakes; that is why I need some confirmationā¦