Skip to content

Commit

Permalink
Merge pull request #879 from pkuehnel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pkuehnel authored Aug 23, 2023
2 parents 0ccb67a + 26848e9 commit d0d9655
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Plugins.Modbus/Plugins.Modbus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="FluentModbus" Version="5.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion Plugins.SmaEnergymeter/Plugins.SmaEnergymeter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Quartz" Version="3.7.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Plugins.SolarEdge/Plugins.SolarEdge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Plugins.Solax/Plugins.Solax.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions TeslaSolarCharger.Tests/TeslaSolarCharger.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<PackageReference Include="Autofac.Extras.Moq" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.5" />
<PackageReference Include="xunit" Version="2.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion TeslaSolarCharger/Client/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ else
@if (car.ChargeInformation.Count > 0)
{
<p>
Car will @(car.State == CarStateEnum.Charging ? "stop" : "start") charging when following conditions are met:<br/>
Car will @(car.HomeChargePower > 0 ? "stop" : "start") charging when following conditions are met:<br/>
<ul>
@foreach (var chargeInfo in car.ChargeInformation)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ internal async Task<List<DtoChargingSlot>> PlanChargingSlots(Car car, DateTimeOf
plannedChargingSlots.Add(new DtoChargingSlot()
{
ChargeStart = dateTimeOffSetNow,
ChargeEnd = DateTimeOffset.MaxValue,
ChargeEnd = dateTimeOffSetNow.AddDays(1),
});
break;

Expand Down
1 change: 1 addition & 0 deletions TeslaSolarCharger/Server/Services/ConfigJsonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public async Task UpdateAverageGridVoltage()
.Where(c => c.ChargingProcess.Geofence != null
&& c.ChargingProcess.Geofence.Name == homeGeofence
&& c.ChargerVoltage > lowestGridVoltageToSearchFor)
.OrderByDescending(c => c.Id)
.Select(c => c.ChargerVoltage)
.Take(1000)
.ToListAsync().ConfigureAwait(false);
Expand Down
15 changes: 13 additions & 2 deletions TeslaSolarCharger/Server/Services/TeslaMateMqttService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class TeslaMateMqttService : ITeslaMateMqttService
private readonly ISettings _settings;
private readonly IConfigurationWrapper _configurationWrapper;
private readonly IConfigJsonService _configJsonService;
private readonly IDateTimeProvider _dateTimeProvider;

// ReSharper disable once InconsistentNaming
private const string TopicDisplayName = "display_name";
Expand Down Expand Up @@ -56,14 +57,15 @@ public class TeslaMateMqttService : ITeslaMateMqttService

public TeslaMateMqttService(ILogger<TeslaMateMqttService> logger, IMqttClient mqttClient, MqttFactory mqttFactory,
ISettings settings, IConfigurationWrapper configurationWrapper,
IConfigJsonService configJsonService)
IConfigJsonService configJsonService, IDateTimeProvider dateTimeProvider)
{
_logger = logger;
_mqttClient = mqttClient;
_mqttFactory = mqttFactory;
_settings = settings;
_configurationWrapper = configurationWrapper;
_configJsonService = configJsonService;
_dateTimeProvider = dateTimeProvider;
}

public async Task ConnectMqttClient()
Expand Down Expand Up @@ -351,7 +353,16 @@ internal void UpdateCar(TeslaMateValue value)
_logger.LogTrace("{topicName} changed to {value}", nameof(TopicScheduledChargingStartTime), value.Value);
if (!string.IsNullOrWhiteSpace(value.Value))
{
car.CarState.ScheduledChargingStartTime = DateTimeOffset.Parse(value.Value);
var parsedScheduledChargingStartTime = DateTimeOffset.Parse(value.Value);
if (parsedScheduledChargingStartTime < _dateTimeProvider.DateTimeOffSetNow().AddDays(-14))
{
_logger.LogWarning("TeslaMate set scheduled charging start time to {teslaMateValue}. As this is in the past, it will be ignored.", parsedScheduledChargingStartTime);
car.CarState.ScheduledChargingStartTime = null;
}
else
{
car.CarState.ScheduledChargingStartTime = parsedScheduledChargingStartTime;
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion TeslaSolarCharger/Server/TeslaSolarCharger.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Quartz" Version="3.7.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down
11 changes: 1 addition & 10 deletions TeslaSolarCharger/Shared/Dtos/Settings/CarState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private int? ChargingPower
{
float? currentToUse;
//Next lines because of wrong actual current on currents below 5A
if (ChargerRequestedCurrent < 5 && ChargerActualCurrent == ChargerRequestedCurrent + 1)
if ((ChargerRequestedCurrent < 5) && (ChargerActualCurrent == (ChargerRequestedCurrent + 1)))
{
currentToUse = (float?)(ChargerActualCurrent + ChargerRequestedCurrent) / 2;
}
Expand All @@ -63,15 +63,6 @@ private int? ChargingPower
}
}

public int? SetChargingPower
{
get
{
var power = ChargerRequestedCurrent * ChargerVoltage * ActualPhases;
return power;
}
}

public string? StateString { get; set; }
public CarStateEnum? State { get; set; }
public bool? Healthy { get; set; }
Expand Down

0 comments on commit d0d9655

Please sign in to comment.