[Solved] How can I hibernate at a specific battery level

Kernels & Hardware, configuring network, installing services

[Solved] How can I hibernate at a specific battery level

Postby derul » 2017-03-26 16:47

Hi,

I'm running debian 8 jessie with gnome.
I would like to make my system hibernate when battery level is at a certain point, say 30%.

What I tried so far:
Gnome power manager doesn't have an option of changing the critical battery value.
dconf-editor also doesn't give that option.
I also tried to follow another suggestion in archwiki creating a udev rule, but it seems that my battery doesn't sent events to udev (no reports using: "udevadm monitor --property" and "cat sys/class/power_supply/BAT0/alarm" gave 0).

Thanks.
Last edited by derul on 2017-04-04 14:15, edited 2 times in total.
derul
 
Posts: 9
Joined: 2013-09-30 13:05

Re: How to hibernate at specific battery level

Postby phenest » 2017-03-26 19:56

NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: How to hibernate at specific battery level

Postby derul » 2017-03-27 10:26

Thanks for the reply, the script on that post is for ubuntu and needs tweaking for a debian system(files /sys/devices/platform/smapi/BAT0/remaining_percent and /sys/devices/platform/smapi/BAT0/state don't exist on my system)

There must/should be a simpler solution for this trivial task than creating custom scripts.
derul
 
Posts: 9
Joined: 2013-09-30 13:05

Re: How to hibernate at specific battery level

Postby pylkko » 2017-03-27 11:11

I think... (haven't tried) that you can adjust the values in /etc/UPower/UPower.conf. But in reality this may be more complicated as many Desktop Environments might have their own settings that may or may not override the settings that you manually change.

in my file it says
Code: Select all
PercentageLow=10
PercentageCritical=3
PercentageAction=2
CriticalPowerAction=HybridSleep


So at 10% I get a low power notification. Another one saying that system will now shut down at 3% and at 2% it goes into hybrid sleep. You can probablt change these values, for example if you have a battery that cannot provide sufficient voltage any more at, say 7%, then you could put CriticalPowerAction to 8%
User avatar
pylkko
 
Posts: 1108
Joined: 2014-11-06 19:02

Re: How can I hibernate at a specific battery level

Postby debiman » 2017-03-27 17:49

derul wrote:Gnome power manager doesn't have an option of changing the critical battery value.
dconf-editor also doesn't give that option.

wow. reasons to not use gnome just keep piling up.
i know that xfce4-power-manager can do what you want, and it doesn't require a fullblown xfce desktop.
but gnome's powermanager than would probably interfere...

i do have a simple script running for that task, on an old laptop, so that would be my simpler solution.
User avatar
debiman
 
Posts: 1310
Joined: 2013-03-12 07:18

Re: How can I hibernate at a specific battery level

Postby derul » 2017-03-29 18:35

pylkko wrote:I think... (haven't tried) that you can adjust the values in /etc/UPower/UPower.conf. But in reality this may be more complicated as many Desktop Environments might have their own settings that may or may not override the settings that you manually change.

in my file it says
Code: Select all
PercentageLow=10
PercentageCritical=3
PercentageAction=2
CriticalPowerAction=HybridSleep


So at 10% I get a low power notification. Another one saying that system will now shut down at 3% and at 2% it goes into hybrid sleep. You can probablt change these values, for example if you have a battery that cannot provide sufficient voltage any more at, say 7%, then you could put CriticalPowerAction to 8%


The first lines in this file state:
# Only the system vendor should modify this file, ordinary users
# should not have to change anything.
Nevertheless, (after saving a copy) I changed:
first the value of UsePercentageForPolicy to true (since default is false and "time remaining" instead of percentage is considered)
then the percentages to my liking
rebooted to make sure
and it worked!
I didn't get a message for low power (I don't recall if I was getting one before), but I got a message for critical power and one right before the hibernation (all at the specified new percentages).
I 'll give it some time to make sure things are smooth and there are no complications.
Thanks pylkko.
derul
 
Posts: 9
Joined: 2013-09-30 13:05

Re: How can I hibernate at a specific battery level

Postby pylkko » 2017-03-30 15:09

Yeah, I too noticed that message, but it doesn't really say why. So I suppose it might be because other settings may override or conflict with it in some distros/DE's
User avatar
pylkko
 
Posts: 1108
Joined: 2014-11-06 19:02


Return to System configuration

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable