-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from pkuehnel/develop
Develop
- Loading branch information
Showing
81 changed files
with
2,390 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Plugins.SolarEdge.Contracts; | ||
|
||
public interface ICurrentValuesService | ||
{ | ||
Task<int> GetCurrentPowerToGrid(); | ||
Task<int> GetInverterPower(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Plugins.SolarEdge.Contracts; | ||
|
||
namespace Plugins.SolarEdge.Controllers; | ||
|
||
[Route("api/[controller]/[action]")] | ||
[ApiController] | ||
public class CurrentValuesController : ControllerBase | ||
{ | ||
private readonly ICurrentValuesService _currentValuesService; | ||
|
||
public CurrentValuesController(ICurrentValuesService currentValuesService) | ||
{ | ||
_currentValuesService = currentValuesService; | ||
} | ||
|
||
[HttpGet] | ||
public Task<int> GetPowerToGrid() | ||
{ | ||
return _currentValuesService.GetCurrentPowerToGrid(); | ||
} | ||
|
||
[HttpGet] | ||
public Task<int> GetInverterPower() | ||
{ | ||
return _currentValuesService.GetInverterPower(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | ||
WORKDIR /app | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim-amd64 AS build | ||
WORKDIR /src | ||
COPY ["Plugins.SolarEdge/Plugins.SolarEdge.csproj", "Plugins.SolarEdge/"] | ||
RUN dotnet restore "Plugins.SolarEdge/Plugins.SolarEdge.csproj" | ||
COPY . . | ||
WORKDIR "/src/Plugins.SolarEdge" | ||
RUN dotnet build "Plugins.SolarEdge.csproj" -c Release -o /app/build | ||
|
||
FROM build AS publish | ||
RUN dotnet publish "Plugins.SolarEdge.csproj" -c Release -o /app/publish | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "Plugins.SolarEdge.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
// CloudApiValue myDeserializedClass = JsonConvert.DeserializeObject<CloudApiValue>(myJsonResponse); | ||
|
||
public class CloudApiValue | ||
{ | ||
public SiteCurrentPowerFlow SiteCurrentPowerFlow { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class Connection | ||
{ | ||
public string From { get; set; } | ||
public string To { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class Grid | ||
{ | ||
public string Status { get; set; } | ||
public double CurrentPower { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class Load | ||
{ | ||
public string Status { get; set; } | ||
public double CurrentPower { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class Pv | ||
{ | ||
public string Status { get; set; } | ||
public double CurrentPower { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class Storage | ||
{ | ||
public string Status { get; set; } | ||
public double CurrentPower { get; set; } | ||
public int ChargeLevel { get; set; } | ||
public bool Critical { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Plugins.SolarEdge.Dtos.CloudApi; | ||
|
||
public class SiteCurrentPowerFlow | ||
{ | ||
public int UpdateRefreshRate { get; set; } | ||
public string Unit { get; set; } | ||
public List<Connection> Connections { get; set; } | ||
public Grid Grid { get; set; } | ||
public Load Load { get; set; } | ||
public Pv Pv { get; set; } | ||
public Storage Storage { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" /> | ||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" /> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Controllers\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Plugins.SolarEdge; | ||
using Plugins.SolarEdge.Contracts; | ||
using Plugins.SolarEdge.Services; | ||
using Serilog; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
|
||
builder.Services.AddControllers(); | ||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | ||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddSwaggerGen(); | ||
|
||
builder.Services.AddSingleton<SharedValues>(); | ||
builder.Services.AddTransient<ICurrentValuesService, CurrentValuesService>() | ||
; | ||
|
||
builder.Host.UseSerilog((context, configuration) => configuration | ||
.ReadFrom.Configuration(context.Configuration)); | ||
|
||
builder.Configuration | ||
.AddJsonFile("appsettings.json") | ||
.AddEnvironmentVariables(); | ||
|
||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); | ||
if (environment == "Development") | ||
{ | ||
builder.Configuration.AddJsonFile("appsettings.Development.json"); | ||
} | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
|
||
app.UseAuthorization(); | ||
|
||
app.MapControllers(); | ||
|
||
app.Run(); |
Oops, something went wrong.