In degoogling post, I explained how I switch to CalyxOS. One great relief is that, as most google services are not running, I should expect a lower battery consumption and so, a longer battery life.
It was true, until I install Syncthing to sync my data between my devices instead of using centralized Google Drive.The service was draining my whole battery, beeing the only app which eat it.
As I rarely use Wifi networks, I need Syncthing to run over mobile data. The problem is that it runs in background, constantly checking for new data.

before

The main Syncthing app from f-droid, doesn’t provide much battery saving options.

  • Syncthing Options / Disable RestartOnWakeUp : It is supposed to save battery, tried it without success.
  • Running conditions / Disable run on battery : It would be a good solution if I could be able to force a run, even on battery, in emergency case.

Syncthing fork is supposed to be a better solution.

The README says that “Battery eater problem is fixed.”, so I asked the dev for more explainations, his answer was a bit light.
Despite the fact that the fork gives some finer options to deal with battery consumption, it allowed me to save no more than 2 or 3 battery hours.

The solution would be to sync only on specific conditions, to reduce the running syncing window. Luckily, Syncthing has an option to Respect Android parameter about Data Syncing, and some automation tools exists.

Easer automation tool

Easer is an Android event driven automation tool.
I want my sync to be disabled when the screen is locked. When the screen is unlocked, I want to limit sync to 1 min.
As my main concern is battery consumption, I want to always sync when battery is charging.
I usually charge at home, which is the only place where I use Wifi, lets trigger it then.

Here’s my configuration.

Conditions

Conditions are long time events, based on states. I used it to check if the screen is unlocked or the battery is discharging.

conditions unlocked charging

Events

Events are what they are, short time changing states, used for exemple for timing.

events timing

Profils

Profils are set of actions.

profils enable_sync disable_wifi enable_sync_and_wifi disable_sync

Scripts

Scripts link events and conditions to profils.

scripts when_charging when_not_charging when_unlocked disable_sync_when_locked disable_sync_1min

Pivot

This is the global algorithm.

pivot

For 24 hours to … 5 days

After one night, here’s the estimated battery duration time. Syncthing doesn’t even appear in the list, which is normal because it was not syncing at all.

after