OpenWrt x86 on a notebook: Power off when battery is low

Hi everyone!

  • I have installed OpenWrt x86 on a netbook because it is my only choice available at the moment.
  • I need to auto power on it when a electricity outage occurs. I tried using Wake On Lan but this only works when the computer was powered off by the S.O. (ACPI S2,S3).
  • Sadly the BIOS doesn't have any option to resume the power on when electricity comes back.

Mi question is:

It would be possible to configure OpenWRT to auto power off the netbook when the battery charge is low?

Thanks for your answers. :pray:

head -v -n -0 /sys/class/power_supply/*/capacity

https://openwrt.org/docs/guide-user/base-system/cron

1 Like

Thanks for your hints, @vgaetera.
Unfortunately, my linux skills are low and I wasn't able to found the right path to read my battery status.

This is what I have in /sys/class/power_supply/

Could you help me to found where to read my battery status?

Thanks!

root@OMR:/# ls /sys/class/power_supply/
ACAD
root@OMR:/# ls -lR /sys/class/power_supply/ACAD/
/sys/class/power_supply/ACAD/:
lrwxrwxrwx    1 root     root             0 Jan 28 15:53 device -> ../../../ACPI0003:00
-r--r--r--    1 root     root          4096 Jan 28 15:53 online
drwxr-xr-x    2 root     root             0 Jan 28 15:53 power
lrwxrwxrwx    1 root     root             0 Jan 28 15:53 subsystem -> ../../../../../../../../class/power_supply
-r--r--r--    1 root     root          4096 Jan 28 15:53 type
-rw-r--r--    1 root     root          4096 Jan 28 15:53 uevent
drwxr-xr-x    2 root     root             0 Jan 28 10:44 wakeup18

/sys/class/power_supply/ACAD/power:
-rw-r--r--    1 root     root          4096 Jan 28 15:56 autosuspend_delay_ms
-rw-r--r--    1 root     root          4096 Jan 28 15:56 control
-r--r--r--    1 root     root          4096 Jan 28 15:56 runtime_active_time
-r--r--r--    1 root     root          4096 Jan 28 15:56 runtime_status
-r--r--r--    1 root     root          4096 Jan 28 15:56 runtime_suspended_time
-rw-r--r--    1 root     root          4096 Jan 28 15:56 wakeup
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_abort_count
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_active
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_active_count
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_count
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_expire_count
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_last_time_ms
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_max_time_ms
-r--r--r--    1 root     root          4096 Jan 28 15:56 wakeup_total_time_ms

/sys/class/power_supply/ACAD/wakeup18:
-r--r--r--    1 root     root          4096 Jan 28 16:01 active_count
-r--r--r--    1 root     root          4096 Jan 28 16:01 active_time_ms
lrwxrwxrwx    1 root     root             0 Jan 28 16:01 device -> ../../ACAD
-r--r--r--    1 root     root          4096 Jan 28 16:01 event_count
-r--r--r--    1 root     root          4096 Jan 28 16:01 expire_count
-r--r--r--    1 root     root          4096 Jan 28 16:01 last_change_ms
-r--r--r--    1 root     root          4096 Jan 28 16:01 max_time_ms
-r--r--r--    1 root     root          4096 Jan 28 16:01 name
-r--r--r--    1 root     root          4096 Jan 28 16:01 prevent_suspend_time_ms
lrwxrwxrwx    1 root     root             0 Jan 28 16:01 subsystem -> ../../../../../../../../../class/wakeup
-r--r--r--    1 root     root          4096 Jan 28 16:01 total_time_ms
-rw-r--r--    1 root     root          4096 Jan 28 16:01 uevent
-r--r--r--    1 root     root          4096 Jan 28 16:01 wakeup_count
root@OMR:/#
1 Like

I'm afraid this may require a custom build: