Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple batteries in battery-status-graph #2

Open
anarcat opened this issue Mar 15, 2016 · 4 comments
Open

Support multiple batteries in battery-status-graph #2

anarcat opened this issue Mar 15, 2016 · 4 comments

Comments

@anarcat
Copy link
Contributor

anarcat commented Mar 15, 2016

copy of petterreinholdtsen/battery-status#9 - from @solarnz.

battery-status-collect will collect statistics for all batteries that are present on the system, however battery-status-graph assumes that there is only one battery in the log file.

It would be great if battery-status-graph was able to generate separate graphs for each different battery.

@anarcat
Copy link
Contributor Author

anarcat commented Mar 15, 2016

if you are curious, this may be possible / easier with the numpy/matplotlib stuff in the new python grapher i worked on in #10.

i am tearing my hair out on that stuff right now, so i'd gladly let someone else deal with it as well. :)

there are ways to produce multiple figures at once - it seems to me that seperate batteries should have separate plots, something like this:

multiple plots at once

withou the error bars of course...

@ndechesne
Copy link

i am wondering why you said that battery-stats-collector would log information about all batteries, from what I am seeing it would only collect the info for 1 battery only. there is a for loop, but there is a break statement.

on my system with 2 batteries, the log only contain information about 1 battery, not 2. and yes, I agree it would be nice to see them all.

@petterreinholdtsen
Copy link
Owner

Note, anarcat talked about battery-status-collect, which is a different program from battery-stats-collector. It was the name of collect-csv when the package was named battery-status. I'm in the process of adding two collectors to the package, one collecting the original format to /var/log/battery-stats, the other collecting in a new format to /var/log/battery-stats.csv.

@anarcat
Copy link
Contributor Author

anarcat commented Aug 26, 2018

so with the patches in #28 and #25, it's actually possible to graph multiple batteries at once. they just all end up in the same graph, which is kind of ugly and confusing, but works.

here's an example:

batt

thanks to #25, it doesn't freak out when trying to guess battery expiry and still draws the graph:

$ ./src/battery-stats-graph --output ~/Downloads/batt.png
loading CSV file ['/var/log/battery-stats.csv'] with builtin CSV module
building data array
guessing expiry
could not guess battery expiry: On entry to DLASCL parameter number 4 had an illegal value
building graph
drawing to file <open file '/home/anarcat/Downloads/batt.png', mode 'w' at 0x7f2c247c2b70>

It's also possible (but hackish) to grep only for one battery identifier and generate a graph just for that:

batt

And then it can guess the expiry correctly:

$ (head -1 /var/log/battery-stats.csv ; grep -a 45N1025 '/var/log/battery-stats.csv') | ./src/battery-stats-graph --output ~/Downloads/batt.png -
loading CSV file ['-'] with builtin CSV module
building data array
guessing expiry
this battery will reach end of life (5%) in 100 days, 4:26:53.646381, on 2018-12-04 20:55:54.157078
building graph
drawing to file <open file '/home/anarcat/Downloads/batt.png', mode 'w' at 0x7f9585983b70>

I'm happy this works, but I'm sad my battery is such crap! :)

For what it's worth, here's the graph I get with only #25... It's a bit confusing: unless you notice the date on the lower right, you can easily believe the battery is alright. :)

batt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants