teslamate-org / teslamate

A self-hosted data logger for your Tesla 🚘
https://docs.teslamate.org
MIT License
5.76k stars 719 forks source link

Battery Health not plotting #4079

Open 07stuntar1 opened 2 months ago

07stuntar1 commented 2 months ago

Is there an existing issue for this?

What happened?

Can someone please help. I hadn't updated in a few upgrades but Battery Health and Battery Health LFP were combine and for some reason I lost data points and it's still not graphing. Prior if I were to click on Battery Health it would occasionally plot. (pic below) LFP data would plot on every charge but since has dissaperad and only see Battery Health. Someone mentioned my data base could be missing point but it still does not seem to plot new points with the latest update. Im not sure what i need to do to fix it. It seem like all other data is being recorded.

image

Expected Behavior

Data to be plotted

Steps To Reproduce

No response

Relevant log output

2024-07-11 18:30:57.185 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:30:57.185 car_id=11 [error] Error / :unknown,
2024-07-11 18:31:00.680 [notice]     :alarm_handler: {:set, {TeslaMate.Vehicles.Vehicle_11_api_error, :fuse_blown}},
2024-07-11 18:31:10.765 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 540 (3579.645 ms),
2024-07-11 18:31:10.766 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:31:10.766 car_id=11 [error] Error / :unknown,
2024-07-11 18:31:23.744 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 540 (2977.345 ms),
2024-07-11 18:31:23.744 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:31:23.744 car_id=11 [error] Error / :unknown,
2024-07-11 18:31:36.408 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 540 (2662.083 ms),
2024-07-11 18:31:36.408 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:31:36.408 car_id=11 [error] Error / :unknown,
2024-07-11 18:31:49.358 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 540 (2948.116 ms),
2024-07-11 18:31:49.358 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:31:49.358 car_id=11 [error] Error / :unknown,
2024-07-11 18:32:52.678 [warning] Too many disconnects from streaming API,
2024-07-11 18:32:52.678 car_id=11 [info] Creating new connection … ,
2024-07-11 18:32:52.678 car_id=11 [info] Disconnecting ...,
2024-07-11 18:32:52.687 car_id=11 [info] Connecting ...,
2024-07-11 18:34:08.048 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 408 (9117.571 ms),
2024-07-11 18:34:08.049 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:34:08.049 car_id=11 [error] Error / :unknown,
2024-07-11 18:34:27.170 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 408 (9120.604 ms),
2024-07-11 18:34:27.171 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:34:27.171 car_id=11 [error] Error / :unknown,
2024-07-11 18:34:45.501 [info] GET https://nominatim.openstreetmap.org/reverse -> 200 (441.444 ms),
2024-07-11 18:34:45.998 [info] GET https://nominatim.openstreetmap.org/reverse -> 200 (492.714 ms),
2024-07-11 18:34:46.007 [info] End of drive initiated by: %TeslaApi.Vehicle.State.Drive{active_route_destination: nil, active_route_energy_at_arrival: nil, active_route_latitude: nil, active_route_longitude: nil, active_route_miles_to_arrival: nil, active_route_minutes_to_arrival: nil, active_route_traffic_minutes_delay: nil, gps_as_of: 1720722876, heading: 131, latitude: 21.305824, longitude: -157.854626, native_latitude: 21.305824, native_location_supported: 1, native_longitude: -157.854626, native_type: "wgs", power: 0, shift_state: nil, speed: nil, timestamp: 1720722877667},
2024-07-11 18:34:46.007 car_id=11 [info] Driving / Ended / 13 km – 34 min,
2024-07-11 18:34:46.007 car_id=11 [info] Start / :online,
2024-07-11 18:35:55.147 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 408 (9135.583 ms),
2024-07-11 18:35:55.148 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:35:55.148 car_id=11 [error] Error / :unknown,
2024-07-11 18:36:24.280 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 408 (9130.950 ms),
2024-07-11 18:36:24.280 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:36:24.280 car_id=11 [error] Error / :unknown,
2024-07-11 18:36:53.436 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744619233578131/vehicle_data -> 408 (9155.126 ms),
2024-07-11 18:36:53.436 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:36:53.436 car_id=11 [error] Error / :unknown,
2024-07-11 18:38:00.687 [notice]     :alarm_handler: {:clear, TeslaMate.Vehicles.Vehicle_11_api_error},
2024-07-11 18:38:02.170 car_id=11 [info] Received stream data: :inactive,
2024-07-11 18:44:59.450 car_id=10 [info] Start / :online,
2024-07-11 18:44:59.464 car_id=10 [info] Connecting ...,
2024-07-11 18:46:15.807 car_id=11 [info] Received stream data: :inactive,
2024-07-11 18:47:11.583 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 408 (9145.416 ms),
2024-07-11 18:47:11.583 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:47:11.584 car_id=10 [error] Error / :unknown,
2024-07-11 18:47:40.726 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 408 (9140.629 ms),
2024-07-11 18:47:40.726 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:47:40.726 car_id=10 [error] Error / :unknown,
2024-07-11 18:48:09.867 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 408 (9140.194 ms),
2024-07-11 18:48:09.867 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:48:09.867 car_id=10 [error] Error / :unknown,
2024-07-11 18:48:34.026 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 540 (4158.350 ms),
2024-07-11 18:48:34.026 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:48:34.026 car_id=10 [error] Error / :unknown,
2024-07-11 18:48:56.984 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 540 (2956.348 ms),
2024-07-11 18:48:56.984 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:48:56.984 car_id=10 [error] Error / :unknown,
2024-07-11 18:49:00.698 [notice]     :alarm_handler: {:set, {TeslaMate.Vehicles.Vehicle_10_api_error, :fuse_blown}},
2024-07-11 18:49:20.050 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 540 (3063.975 ms),
2024-07-11 18:49:20.050 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:49:20.050 car_id=10 [error] Error / :unknown,
2024-07-11 18:49:30.933 car_id=10 [info] Received stream data: :inactive,
2024-07-11 18:49:43.251 [warning] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 540 (3200.025 ms),
2024-07-11 18:49:43.251 [warning] TeslaApi.Error / vehicle error: it is online but not responsive,
2024-07-11 18:49:43.251 car_id=10 [error] Error / :unknown,
2024-07-11 18:50:12.390 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/3744594196171087/vehicle_data -> 408 (9136.686 ms),
2024-07-11 18:50:12.390 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil},
2024-07-11 18:50:12.390 car_id=10 [error] Error / :unknown,
2024-07-11 18:50:33.037 car_id=10 [info] Suspending logging,
2024-07-11 18:53:24.015 car_id=11 [info] Received stream data: :inactive,
2024-07-11 18:53:36.564 [warning] Too many disconnects from streaming API,
2024-07-11 18:53:36.564 car_id=11 [info] Creating new connection … ,
2024-07-11 18:53:36.564 car_id=11 [info] Disconnecting ...,
2024-07-11 18:53:36.568 car_id=11 [info] Connecting ...,
2024-07-11 18:54:41.140 [warning] Too many disconnects from streaming API,
2024-07-11 18:54:41.140 car_id=10 [info] Creating new connection … ,
2024-07-11 18:54:41.140 car_id=10 [info] Disconnecting ...,
2024-07-11 18:54:41.145 car_id=10 [info] Connecting ...,
2024-07-11 18:56:00.709 [notice]     :alarm_handler: {:clear, TeslaMate.Vehicles.Vehicle_10_api_error},
2024-07-11 18:57:06.830 [info] Streaming API: Vehicle offline,
2024-07-11 18:57:06.830 car_id=10 [warning] Stream reports vehicle as offline, fetching vehicle state ...,
2024-07-11 18:57:07.002 car_id=10 [info] Start / :offline,
2024-07-11 18:57:07.005 car_id=10 [info] Disconnecting ...,
2024-07-11 19:07:34.865 [warning] Too many disconnects from streaming API,
2024-07-11 19:07:34.865 car_id=11 [info] Creating new connection … ,
2024-07-11 19:07:34.866 car_id=11 [info] Disconnecting ...,
2024-07-11 19:07:34.870 car_id=11 [info] Connecting ...,
2024-07-11 19:21:29.065 [warning] Too many disconnects from streaming API,
2024-07-11 19:21:29.065 car_id=11 [info] Creating new connection … ,
2024-07-11 19:21:29.065 car_id=11 [info] Disconnecting ...,
2024-07-11 19:21:29.069 car_id=11 [info] Connecting ...,
2024-07-11 19:37:26.089 [warning] Too many disconnects from streaming API,
2024-07-11 19:37:26.089 car_id=11 [info] Creating new connection … ,
2024-07-11 19:37:26.089 car_id=11 [info] Disconnecting ...,
2024-07-11 19:37:26.094 car_id=11 [info] Connecting ...,
2024-07-11 19:40:24.106 car_id=11 [info] Received stream data: :inactive,
2024-07-11 19:45:47.107 [info] GET /,
2024-07-11 19:45:47.115 [info] Sent 200 in 7ms

Screenshots

Untitled

Additional data

No response

Type of installation

Docker

Version

1.30.0

cwanja commented 2 months ago

Are your charges still being properly logged?

JakobLichterfeld commented 2 months ago

Do you have a LFP Battery? Did you changed your car setting in TeslaMate Webpage to LFP?

07stuntar1 commented 2 months ago

Are your charges still being properly logged?

Yes it shows charges being logged

image
07stuntar1 commented 2 months ago

Do you have a LFP Battery? Did you changed your car setting in TeslaMate Webpage to LFP?

I do not have an LFP battery but it was recording on LFP instead of the non lfp when it was separate. I have 2 long range Y 2024 both the same issue.

07stuntar1 commented 1 month ago

Any suggestions its still not plotting

JakobLichterfeld commented 1 month ago

Still waiting on your feedback:

Did you changed your car setting in TeslaMate Webpage to LFP?

Additional: Did you played with dashboards? If so, please do

bigethan commented 3 weeks ago

To add a data point - I'm having the same or similar issue on a fresh install with a 2023 Long Range Y.

All other dashboards, including charging, work except for the battery health. It shows "No Data" for it's sections. The dashboard shows the alert/error: db query error: pq: invalid input syntax for type json. And in the db logs it looks like:

database-1   | 2024-08-21 17:29:42.705 UTC [8037] ERROR:  invalid input syntax for type json at character 98
database-1   | 2024-08-21 17:29:42.705 UTC [8037] DETAIL:  The input string ended unexpectedly.
database-1   | 2024-08-21 17:29:42.705 UTC [8037] CONTEXT:  JSON data, line 1: 
database-1   | 2024-08-21 17:29:42.705 UTC [8037] STATEMENT:  SELECT convert_km(AVG(p.odometer)::numeric,'mi') AS odometer, 
database-1   |      AVG(c.rated_battery_range_km * (''::json -> 'RatedEfficiency')::text::float / c.usable_battery_level) AS "kWh",
database-1   |      MAX(cp.id) AS id,
database-1   |      to_char(cp.end_date, 'YYYY-MM-dd') AS Title
database-1   |      FROM charging_processes cp
database-1   |          JOIN (SELECT charging_process_id, MAX(date) as date FROM charges WHERE usable_battery_level > 0 GROUP BY charging_process_id) AS last_charges   ON cp.id = last_charges.charging_process_id
database-1   |          INNER JOIN charges c
database-1   |          ON c.charging_process_id = cp.id AND c.date = last_charges.date
database-1   |          INNER JOIN positions p ON p.id = cp.position_id
database-1   |      WHERE cp.car_id = 1
database-1   |          AND cp.end_date IS NOT NULL
database-1   |          AND cp.charge_energy_added >= (''::json -> 'RatedEfficiency')::text::float
database-1   |      GROUP BY 4
database-1   | 2024-08-21 17:29:42.705 UTC [8039] ERROR:  invalid input syntax for type json at character 157
database-1   | 2024-08-21 17:29:42.705 UTC [8039] DETAIL:  The input string ended unexpectedly.
database-1   | 2024-08-21 17:29:42.705 UTC [8039] CONTEXT:  JSON data, line 1: 
database-1   | 2024-08-21 17:29:42.705 UTC [8039] STATEMENT:  SELECT 
database-1   |    ROUND(MIN(convert_km(p.odometer::numeric,'mi')),0) AS "M-Odometer",
database-1   |      ROUND(PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY c.rated_battery_range_km * (''::json -> 'RatedEfficiency')::text::float / c.usable_battery_level)::numeric,1) AS "M-kWh",
database-1   |      to_char(cp.end_date, 'YYYYMM') || CASE WHEN to_char(cp.end_date, 'DD')::int <= 15 THEN '1' ELSE '2' END  AS Title
database-1   |      FROM charging_processes cp
database-1   |          JOIN (SELECT charging_process_id, MAX(date) as date FROM charges WHERE usable_battery_level > 0 GROUP BY charging_process_id) AS last_charges   ON cp.id = last_charges.charging_process_id
database-1   |          INNER JOIN charges c
database-1   |          ON c.charging_process_id = cp.id AND c.date = last_charges.date
database-1   |          INNER JOIN positions p ON p.id = cp.position_id
database-1   |      WHERE cp.car_id = 1
database-1   |          AND cp.end_date IS NOT NULL
database-1   |          AND cp.charge_energy_added >= (''::json -> 'RatedEfficiency')::text::float
database-1   |      GROUP BY 3
JakobLichterfeld commented 3 weeks ago

To add a data point - I'm having the same or similar issue on a fresh install with a 2023 Long Range Y.

Thanks for reporting. How many charges did you have logged with TeslaMate?

@jheredianet May I ask you to investigate the above issue? It's a fresh install, therefore I assume the user did not play with the dashboard by himself.

jheredianet commented 3 weeks ago

To add a data point - I'm having the same or similar issue on a fresh install with a 2023 Long Range Y.

database-1 | AVG(c.rated_battery_range_km * (''::json -> 'RatedEfficiency')::text::float / c.usable_battery_level) AS "kWh",

@07stuntar1 @bigethan have in mind that for these estimations all depends on your charges to calculate the efficiency and plot in the graph.

@bigethan As I can see in the previous query RatedEfficiency is blank (null), it's because we only consider chargers that have the following conditions to get the rated efficiency:

Then to plot in the graph, we only plot chargers that have kWh charged more than the rated efficiency.

@07stuntar1 as I can see in your previous screenshots your efficiency is 240 wh/mi (or 149 wh/km), so in the plotted graph you will only see your charge sessions where you added more than 14.9 kWh.

image

Yo only have some charge sessions with that condition, that's why they are not plotted because only charges (added kWh) greater than your efficiency is considered to have a better estimate of battery degradation and not to dirty the samples with short charges that do not allow the BMS to have a better reading of the battery cells state.

JakobLichterfeld commented 3 weeks ago

Thanks so much! In summary, the dashboard works as expected and the error message could be improved.

07stuntar1 commented 3 weeks ago

To add a data point - I'm having the same or similar issue on a fresh install with a 2023 Long Range Y.

database-1 | AVG(c.rated_battery_range_km * (''::json -> 'RatedEfficiency')::text::float / c.usable_battery_level) AS "kWh",

@07stuntar1 @bigethan have in mind that for these estimations all depends on your charges to calculate the efficiency and plot in the graph.

@bigethan As I can see in the previous query RatedEfficiency is blank (null), it's because we only consider chargers that have the following conditions to get the rated efficiency:

  • duration > 10 minutes (because we need to get stable data rated, sometimes battery is cold and not enough to rate both in AC and DC)
  • battery level <= 95 (after that level charger is not efficient and the charging power drops a lot)

Then to plot in the graph, we only plot chargers that have kWh charged more than the rated efficiency.

@07stuntar1 as I can see in your previous screenshots your efficiency is 240 wh/mi (or 149 wh/km), so in the plotted graph you will only see your charge sessions where you added more than 14.9 kWh.

image

Yo only have some charge sessions with that condition, that's why they are not plotted because only charges (added kWh) greater than your efficiency is considered to have a better estimate of battery degradation and not to dirty the samples with short charges that do not allow the BMS to have a better reading of the battery cells state.

Thank you ill try and space out my charges to see how it works out.