Skip to content

Commit

Permalink
Merge pull request #1102 from pkuehnel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pkuehnel authored Feb 12, 2024
2 parents f8e1319 + b9ba733 commit f3836f0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion TeslaSolarCharger.Tests/TeslaSolarCharger.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq.EntityFrameworkCore" Version="7.0.0.2" />
<PackageReference Include="Moq.EntityFrameworkCore" Version="8.0.1.2" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.5" />
<PackageReference Include="xunit" Version="2.6.6" />
Expand Down
10 changes: 5 additions & 5 deletions TeslaSolarCharger/Client/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<NavLink class="nav-link px-3" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Overview
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="CarSettings">
<NavLink class="nav-link px-3" href="CarSettings">
<span class="oi oi-wrench" aria-hidden="true"></span> Car Settings
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="ChargePrices">
<NavLink class="nav-link px-3" href="ChargePrices">
<span class="material-symbols-outlined" aria-hidden="true">attach_money</span> Charge Prices
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="BaseConfiguration">
<NavLink class="nav-link px-3" href="BaseConfiguration">
<span class="oi oi-cog" aria-hidden="true"></span> Base Configuration
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="backupAndRestore">
<NavLink class="nav-link px-3" href="backupAndRestore">
<span class="oi oi-data-transfer-download" aria-hidden="true"></span> Backup and Restore
</NavLink>
</div>
Expand Down
12 changes: 5 additions & 7 deletions TeslaSolarCharger/Server/Services/TeslaFleetApiService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System;
using System.Globalization;
using System.Net;
using System.Net.Http.Headers;
Expand All @@ -18,7 +17,6 @@
using TeslaSolarCharger.Shared.Enums;
using TeslaSolarCharger.SharedBackend.Contracts;
using TeslaSolarCharger.SharedBackend.Dtos;
using static System.Net.WebRequestMethods;
using Car = TeslaSolarCharger.Shared.Dtos.Settings.Car;

namespace TeslaSolarCharger.Server.Services;
Expand Down Expand Up @@ -762,7 +760,7 @@ private async Task HandleNonSuccessTeslaApiStatusCodes(HttpStatusCode statusCode
if (statusCode == HttpStatusCode.Unauthorized)
{
logger.LogError(
"Your token or refresh token is invalid. Very likely you have changed your Tesla password.");
"Your token or refresh token is invalid. Very likely you have changed your Tesla password. Response: {responseString}", responseString);
teslaSolarChargerContext.TeslaTokens.Remove(token);
teslaSolarChargerContext.TscConfigurations.Add(new TscConfiguration()
{
Expand All @@ -771,7 +769,7 @@ private async Task HandleNonSuccessTeslaApiStatusCodes(HttpStatusCode statusCode
}
else if (statusCode == HttpStatusCode.Forbidden)
{
logger.LogError("You did not select all scopes, so TSC can't send commands to your car.");
logger.LogError("You did not select all scopes, so TSC can't send commands to your car. Response: {responseString}", responseString);
teslaSolarChargerContext.TeslaTokens.Remove(token);
teslaSolarChargerContext.TscConfigurations.Add(new TscConfiguration()
{
Expand All @@ -781,16 +779,16 @@ private async Task HandleNonSuccessTeslaApiStatusCodes(HttpStatusCode statusCode
else if (statusCode == HttpStatusCode.InternalServerError
&& responseString.Contains("vehicle rejected request: your public key has not been paired with the vehicle"))
{
logger.LogError("Vehicle {vin} is not paired with TSC. Add The public key to the vehicle", vin);
logger.LogError("Vehicle {vin} is not paired with TSC. Add The public key to the vehicle. Response: {responseString}", vin, responseString);
var teslaMateCarId = teslamateContext.Cars.First(c => c.Vin == vin).Id;
var car = teslaSolarChargerContext.Cars.First(c => c.TeslaMateCarId == teslaMateCarId);
car.TeslaFleetApiState = TeslaCarFleetApiState.NotWorking;
}
else
{
logger.LogWarning(
"Staus Code {statusCode} is currently not handled, look into https://developer.tesla.com/docs/fleet-api#response-codes to check status code information",
statusCode);
"Staus Code {statusCode} is currently not handled, look into https://developer.tesla.com/docs/fleet-api#response-codes to check status code information. Response: {responseString}",
statusCode, responseString);
return;
}

Expand Down

0 comments on commit f3836f0

Please sign in to comment.