Skip to content

Commit

Permalink
Merge pull request #1143 from pkuehnel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pkuehnel authored May 25, 2024
2 parents d0baa36 + 6a49ee8 commit d750238
Show file tree
Hide file tree
Showing 261 changed files with 18,328 additions and 3,930 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/versionRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
release_name="Plugins.SmaEnergymeter-$tag-${{ matrix.kind }}"
# Build everything
dotnet publish Plugins.SmaEnergymeter/Plugins.SmaEnergymeter.csproj --runtime "${{ matrix.kind }}" -c Release -o "$release_name"
dotnet publish Plugins.SmaEnergymeter/Plugins.SmaEnergymeter.csproj --runtime "${{ matrix.kind }}" -c Release -o "$release_name" --self-contained
# Pack files
tar czvf "${release_name}.tar.gz" "$release_name"
Expand Down
8 changes: 4 additions & 4 deletions Plugins.Modbus/Plugins.Modbus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentModbus" Version="5.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="FluentModbus" Version="5.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Plugins.Modbus/Services/ModbusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ public async Task<string> GetBinaryString(byte unitIdentifier, ushort startingAd
var byteArray = await GetByteArray(unitIdentifier, startingAddress, quantity, ipAddress, port, connectDelaySeconds, timeoutSeconds, modbusRegisterType, registerSwap).ConfigureAwait(false);
byteArray = byteArray.Reverse().ToArray();
var stringbuilder = new StringBuilder();
foreach (var byteString in byteArray)
foreach (var byteValue in byteArray)
{
stringbuilder.Append(Convert.ToString(byteString, 2).PadLeft(8, '0'));
stringbuilder.Append(Convert.ToString(byteValue, 2).PadLeft(8, '0'));
stringbuilder.Append(_byteDelimiter);
}

Expand Down
6 changes: 3 additions & 3 deletions Plugins.SmaEnergymeter/Plugins.SmaEnergymeter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Quartz" Version="3.8.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Quartz" Version="3.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
Expand Down
4 changes: 2 additions & 2 deletions Plugins.SolarEdge/Plugins.SolarEdge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Plugins.Solax/Plugins.Solax.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.5" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down

This file was deleted.

19 changes: 0 additions & 19 deletions TeslaSolarCharger.GridPriceProvider/ServiceCollectionExtensions.cs

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace TeslaSolarCharger.Model.BaseClasses;

public abstract class JsonXmlResultConfigurationBase : ResultConfigurationBase
{
public string? NodePattern { get; set; }
public string? XmlAttributeHeaderName { get; set; }
public string? XmlAttributeHeaderValue { get; set; }
public string? XmlAttributeValueName { get; set; }
}
11 changes: 11 additions & 0 deletions TeslaSolarCharger.Model/BaseClasses/ResultConfigurationBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using TeslaSolarCharger.SharedModel.Enums;

namespace TeslaSolarCharger.Model.BaseClasses;

public abstract class ResultConfigurationBase
{
public int Id { get; set; }
public decimal CorrectionFactor { get; set; }
public ValueUsage UsedFor { get; set; }
public ValueOperator Operator { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@ public interface ITeslaSolarChargerContext
DbSet<TeslaToken> TeslaTokens { get; set; }
DbSet<TscConfiguration> TscConfigurations { get; set; }
DbSet<Car> Cars { get; set; }
DbSet<RestValueConfiguration> RestValueConfigurations { get; set; }
DbSet<RestValueConfigurationHeader> RestValueConfigurationHeaders { get; set; }
DbSet<RestValueResultConfiguration> RestValueResultConfigurations { get; set; }
DbSet<ChargingProcess> ChargingProcesses { get; set; }
DbSet<ChargingDetail> ChargingDetails { get; set; }
DbSet<ModbusConfiguration> ModbusConfigurations { get; set; }
DbSet<ModbusResultConfiguration> ModbusResultConfigurations { get; set; }
DbSet<MqttConfiguration> MqttConfigurations { get; set; }
DbSet<MqttResultConfiguration> MqttResultConfigurations { get; set; }
void RejectChanges();
}
13 changes: 13 additions & 0 deletions TeslaSolarCharger.Model/Converters/LocalDateTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace TeslaSolarCharger.Model.Converters;

public class LocalDateTimeConverter : ValueConverter<DateTime, DateTime>
{
public LocalDateTimeConverter()
: base(
v => v.ToUniversalTime(), // Store as UTC
v => DateTime.SpecifyKind(v, DateTimeKind.Utc).ToLocalTime()) // Convert to Local on read
{
}
}
37 changes: 36 additions & 1 deletion TeslaSolarCharger.Model/Entities/TeslaSolarCharger/Car.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,41 @@ namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;
public class Car
{
public int Id { get; set; }
public int TeslaMateCarId { get; set; }
public int? TeslaMateCarId { get; set; }
public string? Name { get; set; }
public string? Vin { get; set; }
public TeslaCarFleetApiState TeslaFleetApiState { get; set; } = TeslaCarFleetApiState.NotConfigured;
public ChargeMode ChargeMode { get; set; }
public int MinimumSoc { get; set; }
public DateTime LatestTimeToReachSoC { get; set; }

public bool IgnoreLatestTimeToReachSocDate { get; set; }

public int MaximumAmpere { get; set; }

public int MinimumAmpere { get; set; }

public int UsableEnergy { get; set; }

public bool? ShouldBeManaged { get; set; }
public bool? ShouldSetChargeStartTimes { get; set; }

public int ChargingPriority { get; set; }

public int? SoC { get; set; }
public int? SocLimit { get; set; }

public int? ChargerPhases { get; set; }
public int? ChargerVoltage { get; set; }
public int? ChargerActualCurrent { get; set; }
public int? ChargerPilotCurrent { get; set; }
public int? ChargerRequestedCurrent { get; set; }
public bool? PluggedIn { get; set; }
public bool? ClimateOn { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public CarStateEnum? State { get; set; }
public bool VehicleCommandProtocolRequired { get; set; }

public List<ChargingProcess> ChargingProcesses { get; set; } = new List<ChargingProcess>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class ChargingDetail
{
public int Id { get; set; }
public DateTime TimeStamp { get; set; }
public int SolarPower { get; set; }
public int GridPower { get; set; }

public int ChargingProcessId { get; set; }

public ChargingProcess ChargingProcess { get; set; } = null!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class ChargingProcess
{
public int Id { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public decimal? UsedGridEnergyKwh { get; set; }
public decimal? UsedSolarEnergyKwh { get; set; }
public decimal? Cost { get; set; }
public int? OldHandledChargeId { get; set; }

public int CarId { get; set; }

public Car Car { get; set; } = null!;

public List<ChargingDetail> ChargingDetails { get; set; } = new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using TeslaSolarCharger.Model.BaseClasses;
using TeslaSolarCharger.Shared.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class ModbusConfiguration
{
public int Id { get; set; }
public int UnitIdentifier { get; set; }
public string Host { get; set; }
public int Port { get; set; }
public ModbusEndianess Endianess { get; set; }
public int ConnectDelayMilliseconds { get; set; }
public int ReadTimeoutMilliseconds { get; set; }

public List<ModbusResultConfiguration> ModbusResultConfigurations { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using TeslaSolarCharger.Model.BaseClasses;
using TeslaSolarCharger.Shared.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class ModbusResultConfiguration : ResultConfigurationBase
{
public ModbusRegisterType RegisterType { get; set; }
public ModbusValueType ValueType { get; set; }
public int Address { get; set; }
public int Length { get; set; }
public int? BitStartIndex { get; set; }

public int ModbusConfigurationId { get; set; }
public int? InvertedByModbusResultConfigurationId { get; set; }

public ModbusConfiguration ModbusConfiguration { get; set; }
public ModbusResultConfiguration? InvertedByModbusResultConfiguration { get; set; }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class MqttConfiguration
{
public int Id { get; set; }
public string Host { get; set; }
public int Port { get; set; } = 1883;
public string? Username { get; set; }
public string? Password { get; set; }

public List<MqttResultConfiguration>? MqttResultConfigurations { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using TeslaSolarCharger.Model.BaseClasses;
using TeslaSolarCharger.SharedModel.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class MqttResultConfiguration : JsonXmlResultConfigurationBase
{
public NodePatternType NodePatternType { get; set; }
public string Topic { get; set; }

public int MqttConfigurationId { get; set; }
public MqttConfiguration MqttConfiguration { get; set; } = null!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using TeslaSolarCharger.SharedModel.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class RestValueConfiguration
{
public int Id { get; set; }
public string Url { get; set; }
public NodePatternType NodePatternType { get; set; }
public HttpVerb HttpMethod { get; set; }

public List<RestValueConfigurationHeader> Headers { get; set; } = new();
public List<RestValueResultConfiguration> RestValueResultConfigurations { get; set; } = new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class RestValueConfigurationHeader
{
public int Id { get; set; }
public string Key { get; set; }
public string Value { get; set; }

public int RestValueConfigurationId { get; set; }
public RestValueConfiguration RestValueConfiguration { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using TeslaSolarCharger.Model.BaseClasses;
using TeslaSolarCharger.SharedModel.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class RestValueResultConfiguration : JsonXmlResultConfigurationBase
{
public int RestValueConfigurationId { get; set; }
public RestValueConfiguration RestValueConfiguration { get; set; }
}
Loading

0 comments on commit d750238

Please sign in to comment.