Battery logging?

Post your questions and help other users.

Moderator: Martin

Post Reply
evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Battery logging?

Post by evebrea » 11 Apr 2019 16:44

Is there any functions in automatic to get voltage/wattage of battery/charging states? I was hoping to log to the calendar what sort of power is being supplied (wireless, normal, fast charging) and when started/finished, so I can see if "fast charging" is faster/better than qi or regular 2amp

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

Re: Battery logging?

Post by Desmanto » 12 Apr 2019 06:23

Use Condition Battery Level - Higher than 0%, which will always evaluated to true (unless your phone's battery is error and show 0%).

Why logging to calendar? You can just log it to glovar and export the log later as csv to be analyzed at spreadsheet. I made my own battery logger flow, the basic logger flow is very simple, only this condition battery level + the script from my variable logger flow (modify to exclude some variables). Then there is another flow to manage the logger, to start/stop (automatically at 100%), delete, export the csv or to take screenshot at the battery usage. But the flow is messy, I haven't tidy it up for a long time, so can't really share it without cleanup.

It is using this flow, that I know QuickCharging 2.0 is not effective at my country, because of the high average room temperature (above 30 C). I plot the data on chart and see a lot of charging current fluctuation when using QC 2.0. The phone get warmer than usual charging and experience charging throttling (charging current drop to low mA or even minus). Don't even try wireless charging, it will be much hotter at lower charging speed. My previous phone can easily get above 50 C when using external wireless charging.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Re: Battery logging?

Post by evebrea » 13 Apr 2019 05:26

that uh.. that didn't tell me much. I managed to use the condition of power source connected to get what type of connection (a.c , usb, wireless) but that doesn't help me %100 since regular charging and "turbocharge" are both seen as A.C. I've managed to make it get the start time and save it in a global, then when disconnected use the start time and end time to set the time for the calendar event, and the "charging type" in the name (charging via A.C.) and description using battery_level at the start and end the same way "from 69% to 78%"...

so really all i need is a way to discern one A.C. from the other, perhaps via what voltage/wattage it's getting? Any ideas on that? is there a global that says what sort of power is coming -in- ? I just want to see if standard charging really is slower than "turbo", because just at a glance it hasn't seemed like it, but i've not sat with a stopwatch or anything.

skiptannen
Posts: 82
Joined: 13 Jan 2014 21:39

Re: Battery logging?

Post by skiptannen » 13 Apr 2019 12:39

evebrea,

I also ran into the problem of determining normal charging versus fast charging on my Samsung Note 5. My solution may be a bit roundabout, but what I did was to capture the text of the charging notification when the phone was plugged in. That was the only way I could figure out how to determine when I was charging and when I was fast charging. I'm attaching the core of the flow, but YMMV depending on what kind of phone you have and what notifications it displays on the statusbar.
Attachments
flow_Docked_20190413_083255.xml
(2.95 KiB) Downloaded 796 times

evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Re: Battery logging?

Post by evebrea » 13 Apr 2019 14:34

Hm, mine doesn't seem to do any notifications when charging, wireless or otherwise. So i don't think that'll work

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

Re: Battery logging?

Post by Desmanto » 13 Apr 2019 17:33

Any wall charger will be seen as AC, so it can't differentiate between any 1A charger, 2A charger or QC 2.0/3.0. Most QC phone has proprietary icon to denotes the quick charging. But I can't find where it store that. For skiptannen, the phone can give notification to denotes the quick charging. But for most other, there is no indication for the quick charging.

AFAIK they detect it mostly from the current in. You can simply check the {battery_current_now} (provided by condition Battery Level), if it is lower than -2000 mA (charging give negative value), then it is quick charging. The problem with this checking is, the current can fluctuate, especially after your phone battery reach 70% above and temperature is higher than normal.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply