How can I limit the CPU frequency for HA OS?

Hey guys,

these are my first steps with home assistant, so please excuse of this is a dumb question :wink:
My main intention for setting up HA is to optimize my energy usage in relation to solar power so my HA OS Hardware should use the least amount of power as possible.

I’ve utilized an old thin client hardware with a Intel Celeron 1037U (800-1800mHz) combined with a 120GB ssd for this. The CPU in it’s default state changes his frequency betwenn 900 and 1800 mhz depending on the “load” HA generates.

This results in unecessary power draw. (17W instead fo 6W)
While I imagine that 800mhz would be absolutely enough I do not see any way to set this within Home Asstant like i would with the energy settings in windows.

Can you help me out here? How can I enforce the cpu frequency?

Thanks :slight_smile:

1 Like

There may be a BIOS setting to disable your CPU Turbo.

Something like this: https://techlibrary.hpe.com/docs/iss/proliant-gen10-uefi/s_enable_intel_boost_tech.html

Sorry, forgot to mention: Unfortunately no BIOS settings available on this board :frowning:

Same question, did you find a way?

unfortunately not. I’ve settled for the power usage and found that increasing history retention plus lots of live sensor data that arrives each other second actually puts quite a load on the cpu. :wink: nightly backups take about 80 minutes (with smb transfer) at the moment.

I’d still like to look into reducing the power consumtion as this piles up over the years. For a 5 year period i see a ~350 EUR / 370 USD difference in Power consumtion between 6 and 17W.

1 Like

Same. Mine draws just over a kw a day (22W at idle), wich is 73€ a year, possibly will increase a bit with load. Not the cheapest thing to maintain! I guess I’ll have to keep an eye in those desktop clients.

Have you tried to power the laptop through the battery terminals and see if it throttles a bit that way? I’ll try that next with mine and see if it decides to slow down a bit as they normally more agressive with power management when powered by the battery

did anyone tried to install cpufrequtils? No idea if it will work, but is worth a try.

apk install cpufrequtils

and

cpufreq-set -g userspace
cpufreq-set -f 800Mhz

source: https://www.thinkwiki.org/wiki/How_to_use_cpufrequtils

I have a thin client with no battery connection. I could probably shape a 2-3 Watts off the power consumtion if i switch the psu from the brick style to a highly efficient mean well psu but that would require non-german-conform wire bullshit I want to avoid.

@phsdv

Thanks for the suggestion - where would I do this? I don’t think the GUI Shell lets you install new packages. It also needs to be update and reboot safe.

Install advanced ssh and terminal addon. You can install packages on every start.

I was exploring with this and I set up the advanced ssh and terminal addon. But this only logs me in remotelly to the home assistant. Do you know the correct syntax to install packages? I am following the topic here but they only say it’s possible, now how. Probably missing something obvious?

Thanks!

PS: Using ubuntu the PC idles at arround 9-11W with the display on, so the CPU is not throttling down on HASSIO.

Look at the configuration tab for the addon.

Still not following there. Does the terminal unlock any functionality I don’t already have on the console of the home assistant machine? Or is it just a convenient way to remotelly log in?

I was looking into some system folders based on this topic.

When loging in from the terminal, on the homeassistant screen (Login command prompt) there are some CPU related features available at sys/devices/system/cpu/cpu0/cpufreq/ but I can’t edit these viles using vi, they are read only. I also can’t see them on the samba share or on the hard drive, on another computer. Trying to mount them as in the topiuc above also doesn’t work ( # mount -t sysfs none sys -n -o r). Any ideas?

I was also looking into the CPU speed graph on the homeassistant dash. It seems to throttle, but spends 90% of it’s time at 2GHz. Under Ubuntu it goes down to 1.2 whenever idle. So something is very conservative here.

That could include getting rid of a more than 10 year old cpu build on 22nm and opt in for a cheap, powerful and most important efficient solution. That could include something like odroid m1s which should idle at 1W and max at around 3W (without any tweaking).

So the savings for you in only one year when switching to a device with 3W power consumption is actually more then such a odroid m1s costs.

And just one day ago haos got official support for that device

1 Like

This tens to be a bit more complicated. Technically under Ubunto, by compuyter uses about 8Wall idling. Thats with a spinning hard drive and a 15" LCD in about half brightness. The problem is the power management drivers which are not optimized. I actually managed to change the governor from 3GHz to 1.3Ghz, but somehow, the power consumption didn’t change too much. So I’m pretty sure there is something else adding to the high power, maybe PCI, who knows.

You answer your own question here - I strongly suspect that drive accounts for AT LEAST 5 of that. Unless power management is actively spinning it down when idle (and with HA being a database load I seriously doubt it’s ever truly idle from a disk perspective) Spinning 3.5" consumer grade SATA is typically between 6-12w and often peak up to about 18w (2.5" is marginally better) under heavy load with a lot of random seek. So 8s pretty good.

I agree the odroid is a good option if power is your chief concern.

The Advanced SSH & Web Terminal addon enables not just ssh, but the ability to add packages such as cpufrequtils as suggested by @phsdv. However I have since realised that this won’t work for you, as the home assistant container does not have access to the operating system. Sorry for the distraction.

To get access to the OS you need to activate port 22222 ssh login.

1 Like

I think you misunderstood.
8 watt is a very good consumption and what I am trying to achieve, but I can only do it under Ubuntu.
The spinning drive uses 1.5W idle (spinning) and about 4W reading /writing. So the PC uses about 6W its noticeable cooler too.

So that tells me my computer is capable of very good stats - And in principle doesnt warrant the need to go to a low power PC. It should be idling the majority of the time and hence drawing little power.

Under HASS (Home assistant) I am always pulling 20-22W at idle (Average CPU load is 5%). So clearly something on the power management of the OS is not right. I also used some commands to throttle down the CPU and on the CPU monitor it shows it going down to 1.2GHz, but power consumption doesnt change. Its an intel i5, so nothing too out of the ordinary.

1 Like

Thank you for this suggestion! I was unaware of those devices!

A 4gb ram / 64gb Emmc costs around 90 USD here.
I did not find any versions with larger or detachable mass storage though.

My current HA installation consumes 130GB (30 days retention). And it’s likely to grow since I’ve just gotten started :stuck_out_tongue_winking_eye:

How will the cortex CPU compare to my current CPU? I am beginning to see some minimal delays in larger dashboards like the energy panel but nothing serious.

Also backup to smb takes about 1.2 hours atm.

Since HA is constantly writing to the ssd I do see a noticeable increase in ssd wear level - is there any info on the odroid devices in regards of emmc lifespan?
A turnaround of approx 240gb each month would result in at least 14-19 TBW within 5 years.
I had a very old ssd i have used at first fail already but had no issues simply restoring from backup to a new SSD which was awesome!

Last but not least: I utilize Linux bin bash shell commands with echo output to serial over USB devices /dev/ttyACM0 through home assistant - will this be possible with odroid as well?

Short Addendum:
I’ve found a Benchmark Comparison between my Intel Celeron 1037U and the Rockchip RK3566
Intel Celeron 1037U vs Rockchip RK3566 (gadgetversus.com)

Seems that the Odroid M1S System performs only at half the speed of the old celeron in multicore and only ~ a third in single core benchmarks.
Is home assistant somehow specially optimized for the architecture to compensate for the performance discrepancies or is there a similiar, more powerful system available? :smiley:

I’ve ordered an HP T530, based on an AMD GX-215JJ with a TDP of 10W, it should, see the power figures drop considerably. I will only be able to set it up next month, to get some results.

I’m also looking at the disk wear situation. I want to use my system as a NAS, so an SSD using an M2 slot or a USB 3.0 interface would probably be good for performance.

How do you do your backups - Is that a feature of HA or do you create a disk image using linux?

Quick update here.
I have set up the T530 with a 1TB WD Red SSD and 8GB RAM.
It idles at 5.5W, raising to 8W when a VGA monitor is attached.

Under load I’ve seen it peak at 16Watt with the monitor attached. The results are consistent between Windows 10, Ubuntu and HAOS.

So overall, I’m quite happy - consumption went down quite significantly and it’s fairly easy to upgrade this unit given the choice of internal slots and USB Ports.

While I was imaging the hard drive I got in excess of 100MB/s over the USB 3.0 ports, so backups are a breeze Running the OS through a USB attached drive is feasible for those so inclined.

1 Like