[Android General] ahighfield:
Battery Performance/Stats Profile

I have been trying to take Tasker further with my new OnePlus One phone!

Many of my profiles are currently set out in the OnePlus forum at: https://forums.oneplus.net/threads/what-are-your-favorite-tasker-profiles-with-opo.177460/

Today's project is not really practical, but something I have been interested in getting more insight into my battery performance and stats over a longer period of time.

Likely still a work in progress as experimenting with automatic populating of an online Google Docs excel spreadsheet and offline manual logs, but here goes...The posts on this one thread were very helpful to point me in the right direction: http://xdaforums.com/showthread.php?t=1523053 [I am not entitled to post to that thread yet to thank the author :( ] although I went for I think a simpler approach (let’s see if it pans out with enough flexibility that way). I may yet follow the OP’s lead with separate charge/discharge profiles and add a screen time element as well. I don’t use minimalistic text currently, but can see how that could be helpful for people to keep an eye on their battery performance live on their home screen.

There are two profiles currently:

* Charge Status:

- When plugged in or not, clears and resets variables for the stats used

- Pastes prior cycle results to a log file (oldbattlog.txt)

- Clears current log file for new cycle (battlog.txt)

* Battery Log

- Calculates the variables to monitor battery changes and performance, charge/discharge rates

1: Charge Status

* Context: State/Power/Any

* Task: Batt Stat Clear

- Variable Clear: %Batt0, %Time0 [those are zeros btw]

- Variable Set: %Batt0 To %BATT

- Variable Set: %Time0 To %TIMES

- Copy File: From Tasker/battlog.txt To Tasker/oldbattlog.txt

- Write File: Tasker/battlog.txt, Text: New Log, Append Off

* Exit Task is same Batt Stat Clear task

2: Battery Log

* Context: Event/Power/Battery Changed [fires every time the battery level changes +/- 1%, so I will monitor battery to see if this is affecting overall battery life]

* Task: Battery Log

- Variable Set: %Time1 To %TIMES

- Variable Set: %Batt1 To %BATT

- Variable Set: %Time2 To (%Time1 - %Time0) / 3600, Check Do Maths [calculates time since last battery level change in hours]

- Variable Set: %Battchg To (%Batt0 - %Batt1) / -%Time2, Check Do Maths [calculates the charge/discharge rate in battery level % per hour]

- Variable Set: %Battup To (%TIMES - %Time0) / 3600, Check Do Maths [total time since the charge status, or battery up/charging time]

- HTTP Post: [To my Google Docs Spreadsheet for making charts etc], If: %Battchg>0 [to list stats for when charging to first 3 columns, ie positive]

- HTTP Post: [To my Google Docs Spreadsheet for making charts etc], If: %Battchg<0 [to list stats for when discharging to next 3 columns, ie negative]

- Flash: Text: %Battchg% / hr [OPTIONAL, can also insert your minimalistic text widget update here]

- Write File: Tasker/battlog.txt, Text: %Time2, %BATT, %Battchg, Append On [exports the three data points I am currently interested in to a log file I can then paste into my excel spreadsheet]

Attached the last and current charge/discharge cycle data I turned into charts for reference.