Teslamate: Efficiency null and consumption not working

Created on 14 Apr 2020  路  8Comments  路  Source: adriankumpf/teslamate

Describe the bug
Great software, using since yesterday, donated today :) Unfortunately I just cant read Erlang therefore I am not able to fix it myself, nor understand how this works.

I think I somehow bugged my database because my frist "trip" was just few meters to the garbage can and then I continued which was second trip.

1) efficiency in cars table was null so some of the dashboards was not working. I was not able to read how is it updated or if it is constant. (seems that recalculate_efficiency does that I just dont know when and how :D I found constant in your tests 0.153 (is that in kwh/km?)

2) I dont know the difference between battery_level and usable_battery_level (well I got an idea) but I just dont know why it is calculated for trip/drive consumption. in is_sufficiently_precise and why there is commented out the difference or why it does matter if it differs.

I had a pretty "decent" test trip for logging about 10km and by some coincidence i had endposition.battery_level bigger than endposition.usable_batterylevel so the SQL down bellow evaluates as 1 therefore whole is_sufficiently_precise is false.

I dont know when it can happen that usable_battery_level is lower than battery_level maybe I just ended the trip when some kind of "race condition" happened but I think that the query should not rely on this.

Obvious choice would be checking start_level - end_level against some treshold like atleat 1%

I guess you had some problem with this already as there is a commented out code in the query which does this delta on start/end between levels.

But it can fail on this aswell

duration_min > 1 AND distance > 1 AND ( 
      start_position.usable_battery_level IS NULL OR
       --((start_position.battery_level - start_position.usable_battery_level) = (end_position.battery_level - end_position.usable_battery_level)) OR
      (end_position.battery_level - end_position.usable_battery_level) = 0 
    ) as is_sufficiently_precise,

To Reproduce

as above have trip which has end_position having difference between battery levels

Expected behavior

I would expect that "trip like this" would be counted as significant

Operating environment

  • TeslaMate Version: latest stable docker image
  • Type of installation: Docker
  • OS: Ubuntu
Stale question

All 8 comments

  1. efficiency in cars table was null so some of the dashboards was not working. I was not able to read how is it updated or if it is constant. (seems that recalculate_efficiency does that I just dont know when and how :D I found constant in your tests 0.153 (is that in kwh/km?)

That's normal. The FAQ has more information on this: https://docs.teslamate.org/docs/faq#why-are-no-consumption-values-displayed-in-grafana

  1. I dont know the difference between battery_level and usable_battery_level (well I got an idea) but I just dont know why it is calculated for trip/drive consumption. in is_sufficiently_precise and why there is commented out the difference or why it does matter if it differs.
  • battery_level: A rounded integer % of current state of charge, unaffected by temperature
  • usable_battery_level: A rounded integer % of state of charge with a downward correction for cold temperature, the colder it is the more this deviates from battery_level. This is the value used in the GUI of the car and the app when the display is set to energy, and the difference between battery_level and usable_battery_level is used to show you having "locked-out" range (snowflake) when the car is cold

_Source: https://www.reddit.com/r/teslamotors/comments/bx3yv5/august_2018_build_95k_miles_326_miles_100_charge/eq36tzx/_

If the battery cools down due to cold weather and thus the range is artificially reduced, it is not possible to determine consumption or vampire drain accurately. See also #390.

That's normal. The FAQ has more information on this: https://docs.teslamate.org/docs/faq#why-are-no-consumption-values-displayed-in-grafana

Is this same for the empty and N/A cells in the picture bellow?

Screenshot 2020-04-17 at 22 59 38

Screenshot 2020-04-17 at 23 00 00

Yes, any consumption values are calculated by TeslaMate; the API does not output them directly.

Thanks for the answers I understand and in the longterm it does not matter, however it seems that this happens quite often. I saw that in the other thread there is some discussion about it. I dont have any strong opinion on it, for now I dont mind little discrepancy so I edited the formula :)

since I dont know how to write in elixir, I though would it be helpful if I try to help atleast with documentation? (from user standpoint) if so, on which part should I focus and create PR. thanks

Ultimately, it is a trade-off: should demonstrably incorrect values be displayed or should they simply be blanked out? Both options are not ideal. In the end, thanks to Grafana it' s possible to do exactly what you did: customizing the dashboard yourself. I think this is a good compromise.

since I dont know how to write in elixir, I though would it be helpful if I try to help atleast with documentation? (from user standpoint) if so, on which part should I focus and create PR. thanks

Yes, that would be great! If you feel like some parts could be extended or if you have other ideas how to improve the docs, please create a PR. Specific things that come to my mind:

  • The FAQ could have instructions on how to get logs from docker console as well as how to make it log to disk additionally.
  • The Home Assistant sensors section could be updated with the latest MQTT topics and other HA related stuff (automations, lovelace UI etc.)
  • We really need a guide on how to add translations

Yes I agree that thats great compromise. Btw after TeslaMate update, all the dashboards are overwritten or how does this work ?

regarding the docs, I will try to take a look at some of those. Maybe I will try my Elixir skills to create Home Assistant MQTT discovery :)

I've had my custom dashboards remain between updates. I'm not sure if this will be the case for every update but so far so good.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasehlert picture tobiasehlert  路  4Comments

natrlhy picture natrlhy  路  6Comments

olivercho picture olivercho  路  4Comments

spacecosmos picture spacecosmos  路  5Comments

cwanja picture cwanja  路  3Comments