I have an installation of Home Assistant on a Raspberry pi 4, Supervised, the old HASSIO.
I’m running Hassio 2021.1.0, Supervisor 2020.12.7, Home assistant OS 5.9.
Since i have overclocked my RB4, i would like create a sensor to read the CPU frequence and create a graph on lovelace.
First attempt was the integration:
sensor:
- platform: cpuspeed
but only Home Assistant Core is supported.
Then i try with this command: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
If i launch the command via terminal (internal of HASSIO or with putty) i read the cpu freq correctly so i put the command in a sensor like this:
But the reads are uncorrect: they are always stuck at the top frequenzy (2000 Mhz in my case) and it is not true. If i launch simultaneously by terminal and by the sensor the same command cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
the first measure 6/700 Mhz (the correct value) and the sensor always 2000 Mhz.
Is there a way to read the correct cpu frequency with an Hassio installation and put it in a graph?
Never thought to node-red!
Well, looking for the palette you suggested i found also another.
Given a try first at yours but the values were always stuck at 2000 Mhz, then i tried the second: https://flows.nodered.org/node/node-red-contrib-os
The value are a bit strange: no more fixed at 2000 but never lower of 1500.
I always used the command via terminal to have a comparaison and i am pretty sure the values of both of the node are wrong.
Have to set the arm_freq_min in the boot menu? If it is set to 1500, the freq wont go down below that. For me the node that I shared works fine and its strange its not working for you.
Ok.
No, no arm_freq_min in config.txt.
As you can see in the screen before, looking at the terminals, the cpu goes idle frequently at 600/700 Mhz.
But i’m not able to have these readings within HASSIO.
It’s strange that with that node in node-red you achieve right readings and in my case surly not. When i really go to 2000 Mhz, because a reboot, a system update or something similar, the temperature rise immediately around and over i 65° C, while during the normal operations it is at 46/48° C.
Well 65° C is ok even if you are using no active cooling methods even when its not optimal. The thermal throttling occurs after 80° C only. Since you have overclocked the RPI 4, I suggest you keep a arm_freg_min as the drop between the idle frequency and the maximum is very large. In my case I have active cooling and the max temp that i see is around 52° C when tested with stresspi.
The temperature is not a problem, i know even if now, in winter, my office is quite cold and in summer i think the temperature will rises to more critical level. Anyway, for this problem i have a stupid project of water cooling the rsp
About your tip of writing in config.txt an arm_freq_min: what should be the problems of a large gap between min and max freq?
Hi I know it was over a year ago but I’m looking for a solution without nodeRed.
Is there any solution for this to get the real arm frequency?
vcgencmd doesn’t seem to work with Hass OS.
Note, divide by 1000 for MHz
Change cpu0 to 1, 2, or 3 for other cores
If you look in /sys/devices/system/cpu/cpu0 there is quite a bit of info available, hope this is what you are looking for, TLDR above.