pkuehnel / TeslaSolarCharger

A software to let your Tesla charge with solar energy ☀
GNU General Public License v3.0
120 stars 21 forks source link

Removing scheduled charge in Tesla App leads to immediate charge start #689

Closed donatasnicequestion closed 1 year ago

donatasnicequestion commented 1 year ago

Some minor issue noticed with a Mode Spot+PV: one charging session (as planned ) and another one very short session following the first one:

IMG_20230323_173311

pkuehnel commented 1 year ago

Could you please provide log files of the TeslaSolarCharger container for that time? How to generate logfiles

donatasnicequestion commented 1 year ago

teslasolarcharger.log

please see a log attached (time period acording to screenshot)

pkuehnel commented 1 year ago

The car reported 90% SoC at 23-Mar-2023 04:34:40.754. After stopping the charging process the car reported 89% at 23-Mar-2023 04:35:10.756

I will add a threshold that charging only starts if difference between SoC and configured MinSoc is higher than 2%. Thanks for your logfiles.

pkuehnel commented 1 year ago

@donatasnicequestion The log file indicates that SoC limit in the car is currently set to 94%. For now, you could set the charge limit in the car to 90% as well. Charging does not start if charge limit is less than 3% higher than SoC.

donatasnicequestion commented 1 year ago

Thank you for your effort :) The threshold (2 % difference to desired SoC, in this example 90%) to start would eliminate the behavior described (a second charging session starting directly after the first one). Probably the same like currently https://github.com/pkuehnel/TeslaSolarCharger/blob/f9f40807fa742ded7da5886ebea52add1d56d97c/TeslaSolarCharger/Server/Services/ChargingService.cs#L318

pkuehnel commented 1 year ago

Do you know which version you were on when you had the issue? Looks like this is already implemented 🤔 Need to deeper inspect the issue.

donatasnicequestion commented 1 year ago

the Issue reported was on version v2.14.0 - but i think the issue is still there in a current code.

For my understanding there are three values for Soc:

  1. car.CarState.SocLimit - the limit set by Tesla (App or Car) - provided by Tesla API, for Example: 94 %
  2. car.CarState.Soc - current (or actual) Soc - provided by Tesla API, for example 80%
  3. car. CarConfiguration.MinimumSoC - as configured in TeslaSolarCharger. for example 90%

The threshold is currently implemented for my understanding to handle the case at reaching car.CarState.SocLimit.

I think what is missing is to handle the case reaching car. CarConfiguration.MinimumSoC the same way and not to start charging (again) if car.CarState.SoC >= car. CarConfiguration.MinimumSoC - 2 too (except there is a surplus of solar energy generation - then start / continue charging till the car.CarState.SocLimit is reached ). ?

pkuehnel commented 1 year ago

I thought so, too in the first place but this is also already implemented, see line 39 in https://github.com/pkuehnel/TeslaSolarCharger/blob/master/TeslaSolarCharger/Server/Services/ChargeTimeCalculationService.cs

Seems to be an issue I am not aware of.

pkuehnel commented 1 year ago

@donatasnicequestion I just found an issue and according to your logs, you have the same:

Steps to reproduce:

  1. car is charging due to planned charge
  2. planned charge is at its end
  3. charging is stopped
  4. scheduled charging start time is removed in Tesla app
  5. car starts charging by itself again as removing a scheduled charge in the Tesla app leads to an immediate charge start.

What should happen: scheduled charge in Tesla app should already be removed while charging.

donatasnicequestion commented 1 year ago

Ok, it is a behavior of Tesla API and a car which isn't obvious.

pkuehnel commented 1 year ago

Will be fixed in 2.15.0