Battery Level Trigger Slider

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Post Reply
User avatar
piz
Posts: 18
Joined: 13 Dec 2017 19:56

Battery Level Trigger Slider

Post by piz » 18 Apr 2019 17:26

Hi,

Please add a numeric display (or even a numeric entry field) corresponding to the slider for the battery level setting in the Battery Level trigger. It would be better than having to count those nanosteps on the slider to set a specific level. :)

Thanks!

User avatar
Desmanto
Posts: 1757
Joined: 21 Jul 2017 17:50

Re: Battery Level Trigger Slider

Post by Desmanto » 20 Apr 2019 17:03

+1 for this. Additional request is to add the support of global variable here, especially with nested map. So I can use {global_battery["battery_saver_level"]}
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

Pepy
Posts: 11
Joined: 31 Oct 2018 10:53

Re: Battery Level Trigger Slider

Post by Pepy » 26 Apr 2019 08:20

piz wrote:
18 Apr 2019 17:26
Hi,

Please add a numeric display (or even a numeric entry field) corresponding to the slider for the battery level setting in the Battery Level trigger. It would be better than having to count those nanosteps on the slider to set a specific level. :)

Thanks!
Yes, this should definitely be a thing, not just for the trigger, but for the condition as well. Not only will this make it much less of a hassle to input specific values, but people who use custom names for the module will still be able to view the specific percentage chosen.
Desmanto wrote:
20 Apr 2019 17:03
+1 for this. Additional request is to add the support of global variable here, especially with nested map. So I can use {global_battery["battery_saver_level"]}
Also, Desmanto, why save the battery saver trigger level as a global variable when you can just retrieve it using the action Init Variable Set System Settings from the variable low_power_trigger_level?

User avatar
Desmanto
Posts: 1757
Joined: 21 Jul 2017 17:50

Re: Battery Level Trigger Slider

Post by Desmanto » 26 Apr 2019 17:09

@Pepy : The glovar used so we can determine our own battery level to check. Example at my previous phone, doing TWRP backup can cost 10-15% battery. To make it safe, I use 3x of the limit, at 50%. But at my current phone, it takes only 2-4%. I can use much lower limit, at 10%; but of course I set to higher, 30%. This way, the flow ensure my phone has enough battery before performing the backup.

We can't use other variable in trigger except glovar, since it is the starting point of the flow.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

Pepy
Posts: 11
Joined: 31 Oct 2018 10:53

Re: Battery Level Trigger Slider

Post by Pepy » 27 Apr 2019 22:02

Desmanto wrote:
26 Apr 2019 17:09
@Pepy : The glovar used so we can determine our own battery level to check. Example at my previous phone, doing TWRP backup can cost 10-15% battery. To make it safe, I use 3x of the limit, at 50%. But at my current phone, it takes only 2-4%. I can use much lower limit, at 10%; but of course I set to higher, 30%. This way, the flow ensure my phone has enough battery before performing the backup.

We can't use other variable in trigger except glovar, since it is the starting point of the flow.
Doesn't the Battery Level triggers and conditions already provide the battery level?

Also, in the example you mentioned, the flow checks that your battery percentage is high enough before doing a backup in twrp? If that's so, why is a global variable necessary instead of using the supplied variable from the trigger/condition? And how would you even trigger the backup in the first place, since flows cannot run while the service is not active.

User avatar
Desmanto
Posts: 1757
Joined: 21 Jul 2017 17:50

Re: Battery Level Trigger Slider

Post by Desmanto » 28 Apr 2019 07:28

{battery_level} only provided after the flow is executing. if we put {battery_level} at the trigger, it won't work, as it is not glovar.

Sorry, battey saver level and TWRP flow actually are different, I shouldn't give the examples to compare them. Let just imagine another situation, where we work for normal and overtime. During normal, we set the battey saver will trigger after 30%. But if we work overtime, we want it triggered at 50% (so we can use the phone longer). It is impossible we change the flow everytime we have normal time and overtime. So better put variable to it and use another flow to change the variable as needed (triggered based on calendar or other things).

For TWRP, yes, the condition is actually checked after the flow executed, so yeah, I give wrong example, my bad. TWRP support openrecovery script. My flow will check if the battery level is enough, then it will write the script in the /cache/recovery, reboot to TWRP. After booting to TWRP, it will check if the openrecovery script exists. If yes, execute it. My script include reboot after the backup finish, so it will automatically reboot when finish, showing the result of the backup. Today, sunday, is the scheduled time that the flow will be triggered.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

Post Reply