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

Model Y LR battery capacity incorrectly reporting after 1.28.5 update #3787

Closed
1 task done
AldasG opened this issue Mar 28, 2024 · 14 comments · Fixed by #3795
Closed
1 task done

Model Y LR battery capacity incorrectly reporting after 1.28.5 update #3787

AldasG opened this issue Mar 28, 2024 · 14 comments · Fixed by #3795
Labels
area:dashboard Related to a Grafana dashboard area:grafana Related to Grafana kind:bug Something isn't working

Comments

@AldasG
Copy link

AldasG commented Mar 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

After updating to 1.28.5 Battery Health reports battery capacity as 88kWh (up from ~78kWh) for both 'as new' and current. It was reporting correctly before the update. This is a Model Y LR 2024, Berlin build
Screenshot 2024-03-28 at 11 55 57
I can provide any logs that are necessary, just not sure what I should provide at this point.

Expected Behavior

Battery capacity to be reported correctly (~78kWh)

Steps To Reproduce

No response

Relevant log output

eslamate-1  | 2024-03-28 10:47:06.494 car_id=1 [error] Error / :unknown
teslamate-1  | 2024-03-28 10:47:30.368 car_id=1 [info] Suspending logging
teslamate-1  | 2024-03-28 10:50:38.862 [info] Refreshing access token ...
teslamate-1  | 2024-03-28 10:50:39.252 [info] POST https://auth.tesla.com/oauth2/v3/token -> 200 (377.156 ms)
teslamate-1  | 2024-03-28 10:50:39.294 [info] Scheduling token refresh in 6 h
teslamate-1  | 2024-03-28 10:53:39.132 [notice]     :alarm_handler: {:clear, TeslaMate.Vehicles.Vehicle_1_api_error}
teslamate-1  | 2024-03-28 10:55:09.011 car_id=1 [info] Fetching vehicle state ...
teslamate-1  | 2024-03-28 10:55:09.290 car_id=1 [info] Start / :asleep
teslamate-1  | 2024-03-28 10:55:09.336 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-03-28 11:01:20.598 car_id=1 [info] Start / :online
teslamate-1  | 2024-03-28 11:01:20.667 car_id=1 [info] Connecting ...
teslamate-1  | 2024-03-28 11:04:21.821 car_id=1 [info] Suspending logging
teslamate-1  | 2024-03-28 11:13:32.293 [info] Streaming API: Vehicle offline
teslamate-1  | 2024-03-28 11:13:32.293 car_id=1 [warning] Stream reports vehicle as offline, fetching vehicle state ...
teslamate-1  | 2024-03-28 11:13:32.479 car_id=1 [info] Start / :offline
teslamate-1  | 2024-03-28 11:13:32.527 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-03-28 11:13:52.661 car_id=1 [info] Start / :asleep
teslamate-1  | 2024-03-28 11:50:15.972 [info] GET /
teslamate-1  | 2024-03-28 11:50:16.113 [info] Sent 200 in 132ms
teslamate-1  | 2024-03-28 11:50:21.021 [info] GET /settings
teslamate-1  | 2024-03-28 11:50:21.097 [info] Sent 200 in 76ms

Screenshots

Screenshot 2024-03-28 at 11 55 57

Additional data

No response

Type of installation

Docker

Version

v1.28.5

@cwanja
Copy link
Collaborator

cwanja commented Mar 29, 2024

Can you downgrade TeslaMate and provide a screenshot of 1.28.4 showing a different battery capacity?

@cwanja cwanja added area:grafana Related to Grafana area:dashboard Related to a Grafana dashboard labels Mar 29, 2024
@AldasG
Copy link
Author

AldasG commented Mar 30, 2024

Can you downgrade TeslaMate and provide a screenshot of 1.28.4 showing a different battery capacity?

Just tried that, unfortunately the incorrect capacity remained after the downgrade. Looks like the change is now stuck in the database/grafana? I only downgraded the teslamate instance though.

@JakobLichterfeld
Copy link
Collaborator

I only downgraded the teslamate instance though.

You need to downgrade teslamate grafana image to test with old dashboard.

@jheredianet can you look into this? Ty.

@AldasG
Copy link
Author

AldasG commented Mar 30, 2024

I only downgraded the teslamate instance though.

You need to downgrade teslamate grafana image to test with old dashboard.

@jheredianet can you look into this? Ty.

Downgraded both the grafana and teslamte instance, battery health appears to be normal now:
Screenshot 2024-03-30 at 16 19 38
Screenshot 2024-03-30 at 16 22 13

@JakobLichterfeld
Copy link
Collaborator

Downgraded both the grafana and teslamte instance, battery health appears to be normal now:

Thanks for testing and confirmation.
jheredianet will look into it

@JakobLichterfeld JakobLichterfeld added the kind:bug Something isn't working label Mar 30, 2024
@jheredianet
Copy link
Contributor

Downgraded both the Grafana and Teslamate instance, battery health appears to be normal now:

Hi, this is curious :-)
image

Is it the name of your car, or you have uncomplete data? Just in case verify that in your "cars" table you have only one car.

About the estimations, please could you show a screenshot of your "Efficiency dashboard", since all estimations comes from there, and please, just stay with the last version on Teslamate and Grafana.

If you could manage, please run this query and let me know what values do you get (assuming that your car_id is 1, if not change it accordantly):

SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100.0) AS efficiency FROM ( SELECT (charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric * 100.0 AS efficiency, count(*) AS count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0.01 GROUP BY 1 ORDER BY 2 DESC, 1 DESC LIMIT 1 ) AS DerivatedEfficiency

With that information, I may try to dig further where is the misreading is coming from.

@AldasG
Copy link
Author

AldasG commented Mar 30, 2024

Downgraded both the Grafana and Teslamate instance, battery health appears to be normal now:

Hi, this is curious :-) image

Is it the name of your car, or you have uncomplete data? Just in case verify that in your "cars" table you have only one car.

About the estimations, please could you show a screenshot of your "Efficiency dashboard", since all estimations comes from there, and please, just stay with the last version on Teslamate and Grafana.

If you could manage, please run this query and let me know what values do you get (assuming that your car_id is 1, if not change it accordantly):

SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100.0) AS efficiency FROM ( SELECT (charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric * 100.0 AS efficiency, count(*) AS count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0.01 GROUP BY 1 ORDER BY 2 DESC, 1 DESC LIMIT 1 ) AS DerivatedEfficiency

With that information, I may try to dig further where is the misreading is coming from.

I only have one car to the best of my knowledge! Here's the output of 'SELECT * FROM cars;'
id | eid | vid | model | efficiency | inserted_at | updated_at | vin | name | trim_badging | settings_id | exterior_color | spoiler_type | wheel_type | display_priority | marketing_name
----+-----------------+------------------+-------+------------+---------------------+---------------------+-------------------+------+--------------+-------------+-------------------+--------------+------------+------------------+----------------
1 | 929895910757283 | 1689314385741986 | Y | 0.1491 | 2024-01-13 19:23:55 | 2024-01-26 11:32:05 | XP7Y************* | | 74D | 1 | MidnightCherryRed | None | Apollo19 | 1 | LR AWD
(1 row)

I tried to run the query however received an error:
teslamate=# SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100.0) AS efficiency FROM ( SELECT (charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric * 100.0 AS efficiency, count() AS count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0.01 GROUP BY 1 ORDER BY 2 DESC, 1 DESC LIMIT 1 ) AS DerivatedEfficiency
SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100.0) AS efficiency FROM ( SELECT (charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric * 100.0 AS efficiency, count(
) AS count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0.01 GROUP BY 1 ORDER BY 2 DESC, 1 DESC LIMIT 1 ) AS DerivatedEfficiency;
ERROR: syntax error at or near "SELECT"
LINE 2: SELECT car_id, COALESCE(efficiency, (SELECT efficiency FRO...
^
teslamate=#

I was trying to do it from terminal, I could try to connect to the database with SQL software, but I think I'll need to expose additional ports on my docker compose file?

Here is efficiency dashboard:

Screenshot 2024-03-30 at 18 20 25

@AldasG
Copy link
Author

AldasG commented Mar 30, 2024

@jheredianet Here's results of the query you asked for
Screenshot 2024-03-30 at 18 33 35

@jheredianet
Copy link
Contributor

I only have one car to the best of my knowledge! Here's the output of 'SELECT * FROM cars;' id | eid | vid | model | efficiency | inserted_at | updated_at | vin | name | trim_badging | settings_id | exterior_color | spoiler_type | wheel_type | display_priority | marketing_name ----+-----------------+------------------+-------+------------+---------------------+---------------------+-------------------+------+--------------+-------------+-------------------+--------------+------------+------------------+---------------- 1 | 929895910757283 | 1689314385741986 | Y | 0.1491 | 2024-01-13 19:23:55 | 2024-01-26 11:32:05 | XP7Y************* | | 74D | 1 | MidnightCherryRed | None | Apollo19 | 1 | LR AWD (1 row)

About this, you can see that your car name is empty:
image

You can edit the table to put the correct name (if you want, it's optional). At the moment the car was registered in your Tesla account, something must have happened that did not capture that information correctly.
About rest, let me analyze in your next post.

@jheredianet
Copy link
Contributor

@jheredianet Here's results of the query you asked for Screenshot 2024-03-30 at 18 33 35

So, this is the wrong part, here you get 16.72 and in the efficiency dashboard 14.9 ....
Let me analyze further and I'll get back to you soon...

@jheredianet
Copy link
Contributor

@AldasG I think I found the bug. Please could you run the following query?

SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100) AS efficiency FROM ( SELECT ROUND((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric, 3) * 100 as efficiency, COUNT(*) as count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0 GROUP BY 1 ORDER BY 2 DESC LIMIT 1 ) AS DerivatedEfficiency

@AldasG
Copy link
Author

AldasG commented Mar 30, 2024

SELECT car_id, COALESCE(efficiency, (SELECT efficiency FROM cars WHERE id = 1) * 100) AS efficiency FROM ( SELECT ROUND((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric, 3) * 100 as efficiency, COUNT(*) as count, 1 AS car_id FROM charging_processes WHERE car_id = 1 AND duration_min > 10 AND end_battery_level <= 95 AND start_rated_range_km IS NOT NULL AND end_rated_range_km IS NOT NULL AND charge_energy_added > 0 GROUP BY 1 ORDER BY 2 DESC LIMIT 1 ) AS DerivatedEfficiency

Sure, here you go
Screenshot 2024-03-30 at 22 00 53

@jheredianet
Copy link
Contributor

Ok, now it's ok. I will make a PR with the fix. Thanks for reporting the bug.

@AldasG
Copy link
Author

AldasG commented Mar 31, 2024

Ok, now it's ok. I will make a PR with the fix. Thanks for reporting the bug.

Great, let me know if there’s anything else I can test out/provide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dashboard Related to a Grafana dashboard area:grafana Related to Grafana kind:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants