How to set up an Odroid with Home Assistant (cpufreq)

I set up an Odroid M1 with Home Assistent to log my Energy consumption.
Somehow I got a configuration with a Shelly EM and DSMR working.
The SSH connection proofed another hurdle, but eventually I could log in.

Like I expected the governor for the Odroid was set to ‘performance’ (default).
How do I set it to ‘conservative’ at boot?
(Since HA is supposed to be working 24/7 I gladly reduce the consumption by even a slight amount.)

With regards,
Specs

What I did as workaround:

  • login as hassio
  • mount sysfs in rw-mode on an alternative location
    # mount -t sysfs none sys -n -o r
  • change the governor
    # echo conservative > sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    Since I don’t have a NVMe attached I included powersavings for PCIE.
    # echo powersupersave > sys/module/pcie_aspm/parameters/policy

If I could replace the echo-lines with a startup script, it should be fine.

  1. Create a script with those commands below /config
  2. Create a shell_command calling that script
  3. Execute that command through an automation with a HA start trigger
    - platform: homeassistant
      event: start

Reading your answer I have been reading left and right.

  1. I did make a sh-script in /config (I don’t think the 60 sec limit will be a problem)
  2. the script is included a shell_command in configuration.yaml
  3. I did find the homeassistant start option in automations

I’m going to test with a button first, before I ruin my installation.
Thanks so far, I will try and hope to be able to report success soon.

Current result:

If I define the automation and run the event it says ‘succeeded’ but it does not do anything.
The event itself just fails.

alias: "ConservativeMode "
description: Run script to set conservative mode on boot
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: shell_command.conservative_sh
    data: {}
mode: single

And in /config/configuration.yaml:

shell_command:
  conservative_sh: set_conservative_mode.sh

So I did run the script by hand again (I assume it might be a privilege problem, since I need admin rights for the script).

Finally got it working :smiley:

I changed the shell command to:

shell_command:
  conservative_sh: /config/set_conservative_mode.sh

Found some message from 2019 about some scripts for an RPI.
Anyway, it now works for me.