In my last post, I have reviewed an Oittm USB-C/2xUSB-A charger (feel free to take a look, spoiler alert: I like it), I measured the charger’s performance with Tasker. The total charging time project does just this. Shows you how long it took it to charge a device and displays multiple results of your tests. The project is rather simple but I thought I would share it for the benefit of the new Tasker users.
Tasker total charging time project
I want to avoid discharging the battery completely, instead, I starting the measurements at 10%. Regardless of the percentage used, the results should be consistent for each charger. I take the %TIMES (time in seconds) of when the charging starts, until the 100% charge.
While entire Tasker total charging time project can be written in the vanilla Tasker – I will use AutoTools to display the information and do the calculations. Otherwise, you are facing a small subroutine to get the %TIMES to Xh:YYmin value. I recommend you do the same!
Getting the total charge time
I think the 10% is good enough. It’s low enough that gives you a reasonable idea how long the entire charge takes, and it is high enough not to mess up your battery. If you set the trigger from 10% to 10% it will start measuring only when the battery reaches 10% (and cable is connected). This will automatically cover the scenarios when you plugged the cable too late (at 5%) and it won’t bother measuring if it’s just a quick charge to top up your phone before you go out.
The profile responsible for stopping the battery is disabled by default. I keep this turned off, otherwise, it will produce some data when the test is not running.
Once I have the start and stop time in seconds, a simple maths calculation provides me with the time span in seconds.
%array set to: %ChargeStop-%ChargeStart
You can either convert it with Tasker, which will take you few actions or use AutoTools Time action to get neatly formatted time as:
%timehours h: %timeminutes min
Please note, that I changed the default output variable to ‘time’. I know this test will be run more than once, therefore I will either use pen and paper to note the results down, or use Tasker. Since you are here to learn Tasker, let’s push the value to an array and get the notification to tell us that the charge has been completed.
Organizing the results
It’s time to display all this. I want to note the charger’s name and the charging conditions (like: I’m charging solo or 2 devices at the same time). I will need two more arrays storing these values. Since I have used the AutoTools already I can use it again to ask for the device name and other info.
This task is triggered by the notification from the Notify action A6 in TASKER PROFILE – Stop Charge (perform task action). It cancels the notification and displays 2 dialogs asking for a device name %Chargers() and charging conditions %Charge_conditions() – both are pushed to the respective arrays (position 1) if the values are assigned. To make things easier, I also set the predefined values to be the same as in the last test. I set two global variables for that %Last_charger & %Last-condition.
Displaying the results
To display the results from Tasker total charging time project I will use AutoTools once more.
AutoTools WebScreen with Cards should do this well. I use three values only:
There you have it! The project is very advanced by any means but does the job. I will continue to use Tasker total charging time project in the future reviews. Feel free to adapt it to any timed events you wish to measure, by modifying the trigger, names etc. As usual, I’m adding the ready made project file for you to download. Feel free to follow me on social media as it helps me grow, share it, and comment if you need any advice. You can also support me, and fund my projects directly.