Skip to content

Commit

Permalink
Merge pull request #1791 from pkuehnel/feat/doNotMultiWakeupWithin20M…
Browse files Browse the repository at this point in the history
…inutes

Feat/do not multi wakeup within 30 minutes
  • Loading branch information
pkuehnel authored Jan 29, 2025
2 parents b396f39 + e6c66ed commit 81be379
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions TeslaSolarCharger/Server/Services/TeslaFleetApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,16 @@ await errorHandlingService.HandleError(nameof(TeslaFleetApiService), nameof(Send
}
await errorHandlingService.HandleErrorResolved(issueKeys.FleetApiNotLicensed, car.Vin);

if (fleetApiRequest.RequestUrl == WakeUpRequest.RequestUrl)
{
var lastWakeUp = car.WakeUpCalls.OrderByDescending(c => c).FirstOrDefault();
if (lastWakeUp != default && lastWakeUp > dateTimeProvider.UtcNow().AddMinutes(-30))
{
logger.LogDebug("Do not send wake up command as last wake up was at {lastWakeUp}", lastWakeUp);
return null;
}
}

var accessToken = await teslaSolarChargerContext.BackendTokens.SingleOrDefaultAsync();
if (accessToken == default)
{
Expand Down

0 comments on commit 81be379

Please sign in to comment.