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
503 stars 167 forks source link

Add statistics of charging speed vs temperature to teslalogger.de #785

Open marki555 opened 2 years ago

marki555 commented 2 years ago

Especially during winter and having LFP battery it would be useful to see the graph of charging speed / temperature on the teslalogger.de website. Not sure how many people have ScanMyTesla connected to Teslalogger to be able to have enough data points about battery temperature. Or at least compare it to outside temperature, if you don't have anough battery temperature data.

Adminius commented 2 years ago

Outside temperature is not the same as battery temperature. Your battery can be hot enough for full charging speed also at -20°C... So the only way: compare ScanMyTesla. But, if you don't use it, how can it help you? You don't see exact battery temperature... You and us also don't know why the battery was hot or cold. How many km before charging was driven. How long precondition was on and so on...

marki555 commented 2 years ago

I have ScanMyTesla for few weeks now and trying to see a relationship between the battery temperature and achievable charging speed. Having it as a graph from multiple ScanMyTesla users would be nice. But are right that correlating outside temperature would be pointless. By the way which metrics does ScanMyTesla export to Teslalogger? All which are available? Because when I turned it on, some metrics update much less frequently (I have a generic slow OBD adapter until my CANserver arrives) on the app.

marki555 commented 2 years ago

I don't see an option to open an issue in ScanMyTesla repo, so I will try here... Is it possible to have ScanMyTesla running in background when the sync to Teslalogger is active? Now when I run the app and switch to the Waze navigation, after some minutes (maybe 10-15) the app stops (when I switch back it starts the communication with the car again). I'm not sure if it is the Android system killing the app or the app itself. Ideally the app would continue to run in background as long as it is connected to the car, but stop itself when I leave the car and the connection to BT adapter is lost.

Adminius commented 2 years ago

which metrics does ScanMyTesla export to Teslalogger

metrics, that you selected ;)

CANserver

cool, but careful with it. Because it uses WiFi, on most phones (like mine) 4G doesn't work any more. And without internet connection you can't send any data to teslalogger

ScanMyTesla running in background

use dedicated/old phone for SMT... all others will not work properly :(

bassmaster187 commented 2 years ago

Is it possible to have ScanMyTesla running in background when the sync to Teslalogger is active? Now when I run the app and switch to the Waze navigation, after some minutes (maybe 10-15) the app stops (when I switch back it starts the communication with the car again).

Go to energy saving settings and disable energy saving for this app so android won't kill it anymore. Android realize scanmytesla will consume more battery than other apps because it uses bluetoot. Therefore it will be the preferred app to kill to save battery. But if you run out of memory it will kill all backround apps. So this trick will just work if you have enough memory.

marki555 commented 2 years ago

@Adminius so SMT will only sync the metrics which are displayed on the current screen? Then why for example Cell temp is now updated only once per few minutes, but before enabling teslalogger sync it was updated maybe every 10 seconds. It seems like when sync is enabled SMT pulls more metrics from the adapter (which slows down the update frequency on slow adapters).

On recent Androids it is possible to have both 4G and Wifi - it will detect Wifi does not have internet and you can tick to stay connected to it anyway. I was thinking about dedicated phone as a dashboard for SMT, but for upload to work I would need another SIM card with internet or always do a hotspot from my main phone, which uses quite a lot battery.

Ok, I will try to exclude SMT from Battery Saving, hopefully it will exit after it loses the BT connection and not keep trying to connect the whole night :)

marki555 commented 2 years ago

I have checked mysql table can on my teslalogger instance I see 132 distinct "id" columns which some of them having more than 3000 entries and many less than 20. I have found some IDs in ScanMyTesla.cs file. I almost always have a screen with power (id 43) and cell temp (id 2) open in SMT. But in the database, power has 3855 entries, but cell temp only 134 entries. So the uploaded metrics list doesn't seem to be consistent with the metrics which are displayed in the active tab in the SMT app.

bassmaster187 commented 2 years ago

So what you are looking for is a 3D Chart with X = SOC Y = Cell Temperature Z = Charging Speed (kW)

Like This: image

bassmaster187 commented 2 years ago

@Adminius so SMT will only sync the metrics which are displayed on the current screen? Then why for example Cell temp is now updated only once per few minutes, but before enabling teslalogger sync it was updated maybe every 10 seconds. It seems like when sync is enabled SMT pulls more metrics from the adapter (which slows down the update frequency on slow adapters).

No, no matter what screen you are, it will send just the signals you selected für Teslalogger. Long press on cloud icon -> select signals ->

Screenshot_20220504-100925

bassmaster187 commented 2 years ago

I did a query on my database:

SELECT count(*) as count, cell_temp, max(charger_power) as kw FROM tesla_taskertoken 
JOIN tesla_chargingstate on tesla_taskertoken.token = tesla_chargingstate.token
join tesla_charging on tesla_chargingstate.id = tesla_charging.cs_id
where cell_temp is not null and name = 'M3 SR+ LFP'
group by cell_temp DIV 5
HAVING count > 5
ORDER BY `tesla_charging`.`cell_temp` ASC;

What I actually have is:

image

marki555 commented 2 years ago

Interesting. This is from your car or everybody with SMT sync enabled? I have LFP battery, which has even very limited regen under 20 degrees (like 35 kW instead of max 85 kW and it drops even more after just few meters downhill). With 9 deg, regen is like 30 kW with fast drop to minimum 14 kW (which is more like Neutral and not braking). Under normal driving car tends to warm and keep the battery at 30 degrees, during preconditioning when navigating to supercharger maybe up to 38 deg.

bassmaster187 commented 2 years ago

Interesting. This is from your car or everybody with SMT sync enabled?

This is from all Model 3 SR+ - I've got a Model S75D

bassmaster187 commented 2 years ago

This is all I can make with my limited Excel skills :-)

image

bassmaster187 commented 2 years ago

sql query:

SELECT count(*) as count, cell_temp, max(charger_power) as kw, 
max(case when battery_level BETWEEN 0 and 10 then charger_power else 0 end) as SOC0_10,
max(case when battery_level BETWEEN 10 and 20 then charger_power else 0 end) as SOC10_20,
max(case when battery_level BETWEEN 20 and 30 then charger_power else 0 end) as SOC20_30,
max(case when battery_level BETWEEN 30 and 40 then charger_power else 0 end) as SOC30_40,
max(case when battery_level BETWEEN 40 and 50 then charger_power else 0 end) as SOC40_50,
max(case when battery_level BETWEEN 50 and 60 then charger_power else 0 end) as SOC50_60,
max(case when battery_level BETWEEN 60 and 70 then charger_power else 0 end) as SOC60_70,
max(case when battery_level BETWEEN 70 and 80 then charger_power else 0 end) as SOC70_80,
max(case when battery_level BETWEEN 80 and 90 then charger_power else 0 end) as SOC80_90

FROM tesla_taskertoken 
JOIN tesla_chargingstate on tesla_taskertoken.token = tesla_chargingstate.token
join tesla_charging on tesla_chargingstate.id = tesla_charging.cs_id
where cell_temp is not null and name = 'M3 SR+ LFP'
group by cell_temp DIV 5
HAVING count > 5
ORDER BY `tesla_charging`.`cell_temp` desc;