bassmaster187 / TeslaLogger

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
https://www.teslalogger.de
GNU General Public License v3.0
517 stars 170 forks source link

Wrong charging information in /admin #1354

Open Naiki92 opened 2 months ago

Naiki92 commented 2 months ago

Append Logfile

Path: wakeup.php
Attribute: t=2ff6db0b
01.09.2024 12:26:20 : #1[Car_1:18]: Charging! Voltage: 227V / Power: 10kW / Timestamp: 1725186379947 / Date: 2024-09-01 12:26:19
01.09.2024 12:26:20 : #1[Car_1:18]: Charging
01.09.2024 12:26:20 : #1[Car_1:18]: ScanMyTesla FastMode: True
01.09.2024 12:26:20 : #1[Car_1:18]: Meter: IsCharging: False / Vehicle Meter: 4934.812 kWh / Utility Meter: NaN kWh / Session Price: NaN / Class: ElectricityMeterEVCC / Version: 0.130.6
01.09.2024 12:26:20 : Distance: 17.1853455489927 - Radius: 40 - 🏠 Home
01.09.2024 12:26:20 : Reverse geocoding by Geofence
01.09.2024 12:26:20 : #1[Car_1:18]: change TeslaLogger state: Online -> Charge

01.09.2024 12:26:20 : #1[Thread Pool Worker:6]: Meter: Not Charging!
01.09.2024 12:26:20 : #1[Thread Pool Worker:9]: GetChargingHistoryV2: NotFound CarState: Charge (OK: 0 - Fail: 1)

Describe the bug The vehicle is charging at 10kW at three phases but /admin shows only 2phases and much lower power.

To Reproduce I think it could be caused by this problem: #1353 The vehicle is currently charged not by the Wallbox set under Settings -> Wallbox

Expected behavior Self explanatory

Screenshots

Bildschirmfoto 2024-09-01 um 12 33 35 Bildschirmfoto 2024-09-01 um 12 33 13

Teslalogger Type Synology Docker

Adminius commented 2 months ago

The problem is Tesla's shity data:

226V, 16A but only 10 kW. 226 16 3= 10848 W = 11kW

I'll take 10 kW, voltage 226V and 16A to calculate phases, because only old S&X can provide real 3-phase number, all newer teslas says "2" if it means 2 or 3 phases :/

https://github.com/bassmaster187/TeslaLogger/blob/master/TeslaLogger/DBHelper.cs#L4999

trunc ((10kW*1000 + 500) / 226V / 16A + 0.3) (correction factor) = 3 (should be...) But it is 2 in your case. one Truncate to much?! :/

with this "2" phases I calculating wrong power => 2 226 16 = 7232 W... Some times, Tesla updates power, but not a current/voltage or vice versa, it leads to wrong caculated values.

Naiki92 commented 2 months ago

Okay, that's shitty, but I have different values between Grafana and the /admin overview. So as you can see the diagram above says 3 phases the whole time (min/max also 3 because I started charging directly with three phases). At the same time on /admin I see 2 phases.

It looks wrong to me even though it solves itself after a few minutes to an hour.

Adminius commented 2 months ago

I'll try to use original values for older S&X (your case). Because of this sh*t I didn't chaged Grafana, so grafana uses still original Tesla values. Than means also, that Grafana shows 2 phases instead of 3 for all 3&Y and also newer S&X users :/ Admin panel is to check how good my implementation works...