lephisto / tesla-apiscraper

API Scraper for pulling Vehicle Statistics from the Tesla Owner API into an InfluxDB + Grafana Dashboards
GNU Lesser General Public License v3.0
365 stars 104 forks source link

Efficiency metrics? #32

Open jat255 opened 5 years ago

jat255 commented 5 years ago

I looked through the API, and I don't see a direct endpoint for efficiency, but it would be nice to have a record of that on the dashboard. I'm guessing it could be calculated by comparing change in the odometer reading and the cumulative sum of the power reading during a drive?

Odometer: image

Power: image

I'm totally new to the world of Grafana/InfluxDB, so I'm not sure what the best way to calculate this is, but it seems doable, from my naive perspective.

lephisto commented 5 years ago

The Better approach would be to compare wh consumed with odometer. This unfortunately isn't too easy with Influx. It could be calculated with a Influx CQ ( Continuous Query). The next major Influx release will support Flux (successor of InfluxQL), where calculation over different measurements can be done, this will be the way to go.

Another Blocker is that the Flux Datasource in Grafana is still very Beta. I expect this to change withing the next weeks, as well.

lephisto commented 5 years ago

btw, the cummulative sum of power is not very exact as well, it's already in the driving row of the new metrics dashboard. Owner API Data is not finegrained enough for that.