Skip to content

Commit

Permalink
Merge pull request #1774 from pkuehnel/fix/preventCallingFleetAPIOnNo…
Browse files Browse the repository at this point in the history
…nLicensedCars

fix(TeslaFleetApiService): Only allow vehicle request via Fleet API on non licensed cars
  • Loading branch information
pkuehnel authored Jan 25, 2025
2 parents 0cefbe8 + af06279 commit 31fdc1c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions TeslaSolarCharger/Server/Services/TeslaFleetApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,15 +937,12 @@ await errorHandlingService.HandleError(nameof(TeslaFleetApiService), nameof(Send
}
}

if (fleetApiRequest.BleCompatible && (!await backendApiService.IsFleetApiLicensed(car.Vin, true)))
if (fleetApiRequest.RequestUrl != VehicleRequest.RequestUrl && (!await backendApiService.IsFleetApiLicensed(car.Vin, true)))
{
if (!car.UseBle)
{
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",
issueKeys.FleetApiNotLicensed, car.Vin, null).ConfigureAwait(false);
}

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",
issueKeys.FleetApiNotLicensed, car.Vin, null).ConfigureAwait(false);

logger.LogError("Can not send Fleet API commands to car {vin} as car is not licensed", car.Vin);
return null;
}
Expand Down

0 comments on commit 31fdc1c

Please sign in to comment.