Please add function for automatic power saving mode

It’s a good idea and I would appreciate it.

There is even more potential to save energy. My favorite features with BBOS 7 were:

  • to switch the phone completely off and on at certain times
  • to automatically switch flight mode on and off at certain times

Very useful for phones that are used exclusively for business purposes. Quiet after work until the next start of work. The on-off function was integrated into the operating system. Additional apps only work when the device is switched on.

Auto ON / OFF in particular reduced consumption to 0 - 0.2% overnight and ensured peace and quiet. A set alarm worked anyway. Such useful functions are completely absent from current phones.

Here’s how I use Situations to power save and be quiet overnight:

Three Situations:

Basic “Sleep” setup (NB: careful with do-not-disturb mode, it will turn OFF alarms!!)

Powersave when charger not connected (powersaving and charging don’t mix):

Flight mode when display is not in use (so flight mode is not activated while doing some late-night internetting).

I am very familiar with situations from my old Nokia, but it’s not the same. Auto ON / OFF with BBOS means that the device is really completely off. This can only be achieved by combining hardware and software. I don’t know of any modern device that can do that. This requires an independent, buffered clock with calendar and a special hardware layout. Situations is just an app. However, any function that relieves the battery is welcome.

If the phone completely switches off and on controlled by clock, the SIM PIN must be switched off. Otherwise the phone hangs on SIM PIN input when switching on again. I consider this not as a good idea. But clock controlled switching to flight mode could be a way.

Note that from command line you can select any percentage value, e.g.

mcetool --set-psm-threshold=100 --set-power-saving-mode=enabled

means power save mode gets activated whenever charger is disconnected.

Power save mode tweaks phone behaviour when the device is in use / handling background synchronization / whatnot - and atm the savings are rather limited.

From idle power consumption point of view: inactivity leads to display dimming and blanking. After which the device gets suspended → whether psm is use/active or not does not matter and power consumption is order of magnitude smaller than what power save mode can accomplish.

[But turning radios off etc according to some kind of schedule as suggested in other comments would lead to further reduction in power consumption.]

4 Likes

IMHO, this group of settings {20%, 15%, 10%, 5%, off} should be extended with two others values {90%, 50%, 20%, 15%, 10%, 5%, off} where 50% indicates a strong propency to saving energy and 90% almost keep the phone locked in energy saving mode.

Moreover, the option:

  • Enable battery saving mode until charger is connected the next time

should change in this more useful:

  • Enable battery saving mode until next time got charged at 90%

The reason it is obvious, it is enough that I connect the smartphone just the time to trasfer some data from it with the MTP via USB and the energy saving mode will be reset to the normal but no a very little charge has been transfered to the battery.

Finally, the threshold in charging at {80%, 90%} will do the rest. In order to keep the smartphone always in energy saving mode. At the cost of few meaningful changes. Personally, I would add 70% at the values above, for those the battery is somehow compromised.

Is it possible to generate a patch for PatchManager to changes this behaviour? Which files are involved in changing reconfiguring the UI and/or its business logic? Because for the message to change, it is supposed to be translated in many languages in order to correctly address the various localisations.

POST SCRIPTUM

The mcetool command line should be installed with

devel-su pkcon install mce-tools

1 Like

Maybe. It is unless there are changes to any binary files required (i.e. source code change and recompilation).
In that case, Patchmanager is not the right tool to use.

(Although in theory, everything PM does should also work for patches to binaries. I don’t think it has been tried though, and it’s not what it’s designed for.)

Take a look at /usr/share/jolla-settings/pages/battery/mainpage.qml from package jolla-settings.

Also, MCE is open-source and you can look at its source code at GitHub - sailfishos/mce, e. g. mce/modules/powersavemode.h at master · sailfishos/mce · GitHub

Also of interest: GitHub - sailfishos/nemo-qml-plugin-systemsettings

Those being Open Source components means you should submit changes as a pull request to Jolla, rather than creating a patch or distributing your own, changed binaries.

Look here on how to localize patches.

2 Likes

Cron jobs were for that purpose. Maybe it’s also with a systemd service possible with a timer. Chatgpt says this: Yes, you can write a systemd timer to shut down the system at a specific time. Here are the steps to do so:

  1. Create a new service file in the systemd directory by running the command:

sudo nano /etc/systemd/system/shutdown.service

  1. Add the following lines to the file:

[Unit]
Description=Shutdown system

[Service]
Type=oneshot
ExecStart=/sbin/poweroff

[Install]
WantedBy=multi-user.target

  1. Save and close the file.

  2. Create a new timer file by running the command:

sudo nano /etc/systemd/system/shutdown.timer

  1. Add the following lines to the file, replacing “HH:MM” with the time you want the system to shut down:

[Unit]
Description=Shutdown at HH:MM

[Timer]
OnCalendar=--* HH:MM:00
Unit=shutdown.service

[Install]
WantedBy=timers.target

  1. Save and close the file.

  2. Reload systemd to pick up the new files:

sudo systemctl daemon-reload

  1. Enable and start the timer:

sudo systemctl enable shutdown.timer
sudo systemctl start shutdown.timer

The system will now shut down at the specified time every day.

2 Likes

Oh and that for the original question, i would only edit the mcetool command to go into power saving mode: Yes, it is possible to create a systemd timer that puts the system into energy-saving mode after a period of inactivity. Here are the steps to do so:

  1. Create a new service file in the systemd directory by running the command:

sudo nano /etc/systemd/system/sleep.service

  1. Add the following lines to the file:

[Unit]
Description=Put system into energy-saving mode

[Service]
Type=oneshot
ExecStart=/usr/bin/mcetool --set-display-power-state=off

[Install]
WantedBy=multi-user.target

  1. Save and close the file.

  2. Create a new timer file by running the command:

sudo nano /etc/systemd/system/sleep.timer

  1. Add the following lines to the file, replacing “X” with the number of minutes of inactivity before the system should go into energy-saving mode:

[Unit]
Description=Put system into energy-saving mode after X minutes of inactivity

[Timer]
OnIdleSec=Xm
Unit=sleep.service

[Install]
WantedBy=timers.target

  1. Save and close the file.

  2. Reload systemd to pick up the new files:

sudo systemctl daemon-reload

  1. Enable and start the timer:

sudo systemctl enable sleep.timer
sudo systemctl start sleep.timer

The system will now go into energy-saving mode after X minutes of inactivity.

2 Likes

I would use the second flag: -T, --set-psm-threshold=<10|20|30|40|50>

-F, --set-forced-psm=<enabled|disabled>

2 Likes

From the good old BB10 times, I have a habit to keep the phone with the display facing down when I don’t use it. So for that use case it would be useful to have an option to have the power saving mode enabled when the phone is placed face down. I guess that a very simple service reading the orientation sensor (it doesn’t have to be too frequently, even once a minute should suffice) and turning the psm mode on/off accordingly would do the job. It might also offer some additional options like enabling/disabling BT, GPS, WiFi etc. when the display is facing down. Maybe I’ll do it if/when I find some spare time…

What exactly does the powersave mode do? Or is this the same mode, when you get the battery warning and your phone is nearly unresponsive, because of the cpu locked to its lowest frequency?

initially I thought of this. This is long ago. Meanwhile this problem seems to no more appear in an annoying way after some SFOS updates since 2021. For me no more a problem.

1 Like

But i still couldn’t find an explanation what this mode does.

It saves battery power while standby / idle. The CPU clock frequency goes down, therefore the CPU consumes less power. Also some circuits of the phone are are switched to standby mode or to deep sleep mode and not full working.

I think that there is a typo here, this would solve

ExecStart=/usr/bin/mcetool --set-power-saving-mode=enabled

However, there is not the counterpart that brings back to the normal state when the screen is unlocked - whetever it needs a PIN or not but just completed the unlock.

I enabled power saving mode with ‘mcetool --set-power-saving-mode=enabled’ turned the display off, wifi disabled, mobile data enabled and checked the log of battery buddy after 45 minutes and it made no difference in power consumption. Has anyone checked this with a phone which doesn’t suffer from battery drain in idle?

try with one of these two:

mcetool --set-power-saving-mode=enabled -T 100%

or

mcetool --set-power-saving-mode=enabled -T 100% -F

In my case the first move the battery drain from 12%/h to 8%/h.

Does the Battery saving mode also enable the power saving mode? Because on my phone enabling the BSM doesn’t provide absolutely any benefits when it comes to battery life and also the CPU clocks do not seem to get reduced.

By looking in mcetool I think you need to use --set-forced-psm=enabled to activate PSM if battery charge is above the threshold.

Power-saving-mode seem to be always enabled and forced-psm gets enabled when you activate PSM in setting.

1 Like