Retrieve time to charge to fullwhen phone is put on charge

41 views
Skip to first unread message

Pete G UK

unread,
Mar 8, 2023, 2:20:10 PM3/8/23
to Tasker
S22 Ultra

The time to charge to 100% is already available within the battery info for the phone. How can I retrieve this info to extend my Tasker notification when charging starts?
Pete

my1sec m

unread,
Mar 8, 2023, 8:48:22 PM3/8/23
to tas...@googlegroups.com
I know you've been struggling to find the answers to your questions before reaching out to me, and my heart goes out to you.
I've only been using Tasker for a few days, so I can't be of much help, sorry.

I really hope you find an answer.

2023년 3월 9일 (목) 오전 4:20, 'Pete G UK' via Tasker <tas...@googlegroups.com>님이 작성:
S22 Ultra

The time to charge to 100% is already available within the battery info for the phone. How can I retrieve this info to extend my Tasker notification when charging starts?
Pete

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/d80c63d2-6565-4246-92ea-33113b9f7d5en%40googlegroups.com.

Brenden M

unread,
Mar 9, 2023, 4:06:16 AM3/9/23
to Tasker
Look for the action to add to a task, Get Battery Info in "System Actions", it can provide a variable:
%bi_time_until_charged
You can use that later in the same Task or make a User variable based on it (MixOfCase, unlike the fully lowercase variable above, which will only exist in that task).

If you use a "variable set" action based on the Battery Info variable, you could use it in other tasks.

Pete Gurney

unread,
Mar 9, 2023, 4:09:11 AM3/9/23
to tas...@googlegroups.com
Thanks, I can find that action but am unsure how to use it in my current task. Could you please give me a brief example of usage Pete 


From: tas...@googlegroups.com <tas...@googlegroups.com> on behalf of Brenden M <nedne...@gmail.com>
Sent: Thursday, March 9, 2023 9:06:16 AM
To: Tasker <tas...@googlegroups.com>
Subject: Re: Retrieve time to charge to fullwhen phone is put on charge
 
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/HUsibxlq6uE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/01e606c5-e8b5-4f55-92a5-498f22d64e90n%40googlegroups.com.

Brenden M

unread,
Mar 9, 2023, 4:17:42 AM3/9/23
to Tasker
Sure, when it runs, it will generate the variables listed. They are described as "output variables" so essentially it will throw a bunch of local (all lowercase) variables it generates when that action comes up when you run the task. So basically, those lowercase variables will simply exist for usage locally within the task.

Therefore, next after that action, run a "variable set" action. 

In Variable Set, try

Name
%BattLevel

To
%bi_level

In your task, first action should be "Get Battery Info", the second task should be "Variable Set".

After you run the task, check the Variables tab. You can use that value anywhere. Similar to any of the local variables, including the one in which you are interested.

Brenden M

unread,
Mar 9, 2023, 4:33:56 AM3/9/23
to Tasker
My phone can take a minute or two before showing data for time until charged. When I access that variable not plugged in it shows "-1" as described in the action info..

So, I would probably approach it by running the task, then using a wait action, then so many seconds or a minute later run the Get Battery Info and the Variable Set.

Then you can use a Say action to read the time allowed. By the way, the time is represented in Milliseconds!!

So in the Variable Set, use

Name
%BattLevel

To
%bi_time_until_charged/60000

Do Maths: yes, check that box

That will render the %BattLevel in "minutes"

Pete Gurney

unread,
Mar 9, 2023, 4:41:12 AM3/9/23
to tas...@googlegroups.com
Many thanks. I'll give this a try later in my existing task which reports charging and the battery current % state. Pete 
Sent: Thursday, March 9, 2023 9:33:56 AM

Pete Gurney

unread,
Mar 11, 2023, 10:59:17 AM3/11/23
to tas...@googlegroups.com
Works perfectly, many thanks!. Quick question, how do I remove the fractional part so rather than saying 10.563 it rounds to the nearest minute, Assuming it's possible  pete
Sent: Thursday, March 9, 2023 10:33:56 AM

Rich D

unread,
Mar 11, 2023, 11:36:49 AM3/11/23
to Tasker Google Groups Post
Quick question, how do I remove the fractional part so rather than saying 10.563 it rounds to the nearest minute,


You can floor() to the equation..

floor(%bi_time_until_charged/60000)

Or  just set the "Max Rounding Digits" option in the variable set action to 0

Pete Gurney

unread,
Mar 11, 2023, 12:20:13 PM3/11/23
to tas...@googlegroups.com
Perfect, solved :) many thanks Pete 
From: tas...@googlegroups.com <tas...@googlegroups.com> on behalf of Rich D <ricp...@gmail.com>
Sent: Saturday, March 11, 2023 5:36:25 PM
To: Tasker Google Groups Post <tas...@googlegroups.com>

Subject: Re: Retrieve time to charge to fullwhen phone is put on charge
 
Quick question, how do I remove the fractional part so rather than saying 10.563 it rounds to the nearest minute,

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/HUsibxlq6uE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages