Skip to content

Commit

Permalink
Merge pull request #1805 from pkuehnel/fix/DoNotUSeFleetApiAsFallback
Browse files Browse the repository at this point in the history
fix(TeslaFleetApiService): check if fleet api can be used as fallback was not correct
  • Loading branch information
pkuehnel authored Feb 2, 2025
2 parents fbea1c3 + e6e9d3b commit 628f8ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TeslaSolarCharger/Server/Services/TeslaFleetApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public async Task WakeUpCar(int carId, bool isFleetApiTest)
{
logger.LogTrace("{method}({carId})", nameof(WakeUpCar), carId);
var car = settings.Cars.First(c => c.Id == carId);
var result = await SendCommandToTeslaApi<DtoVehicleWakeUpResult>(car.Vin, WakeUpRequest, null, true).ConfigureAwait(false);
var result = await SendCommandToTeslaApi<DtoVehicleWakeUpResult>(car.Vin, WakeUpRequest, null, isFleetApiTest).ConfigureAwait(false);
if (car.TeslaMateCarId != default)
{
//ToDo: fix with https://github.com/pkuehnel/TeslaSolarCharger/issues/1511
Expand Down Expand Up @@ -949,7 +949,9 @@ await errorHandlingService.HandleError(nameof(TeslaFleetApiService), nameof(Send
}
}

if (!isFleetApiTest && fleetApiRequest.RequestUrl != VehicleRequest.RequestUrl && (!await backendApiService.IsFleetApiLicensed(car.Vin, true)))
if (!isFleetApiTest
&& (fleetApiRequest.RequestUrl != VehicleRequest.RequestUrl)
&& (!await backendApiService.IsFleetApiLicensed(car.Vin, true)))
{
await errorHandlingService.HandleError(nameof(TeslaFleetApiService), nameof(SendCommandToTeslaApi), $"Fleet API not licensed for car {car.Vin}",
"Can not send Fleet API commands to car as Fleet API is not licensed",
Expand Down

0 comments on commit 628f8ab

Please sign in to comment.