linux - Get Power (Voltage/Watts) with python or bash -
is there possibility input power (like voltage or watts) of linux operating system in python or bash?
my system running battery , want shut down when battery level gets low supply system.
you might want read files in /sys/class/power_supply/bat*/
.
here 2 of more interesting files:
/sys/class/power_supply/bat0/capacity
- shows current capacity (e.g. 75%) /sys/class/power_supply/bat0/status
- current status (e.g. full/discharging/charging)
the information aggregated in /sys/class/power_supply/bat0/uevent
$ cat /sys/class/power_supply/bat0/uevent power_supply_name=bat0 power_supply_status=unknown power_supply_present=1 power_supply_technology=li-ion power_supply_cycle_count=0 power_supply_voltage_min_design=10800000 power_supply_voltage_now=12464000 power_supply_power_now=0 power_supply_energy_full_design=93960000 power_supply_energy_full=95090000 power_supply_energy_now=94830000 power_supply_capacity=99 power_supply_model_name=45n1173 power_supply_manufacturer=sanyo power_supply_serial_number=31144
Comments
Post a Comment