Merge branch 'main' of https://git.innov.energy/Innovenergy/git_trunk
This commit is contained in:
commit
aef9ee4907
csharp
App
Backend
BmsTunnel
Collector
EmuMeterDriver
InnovEnergy.App.propsOpenVpnCertificatesServer
RemoteSupportConsole
SaliMax
VrmGrabber
Lib
Channels
Devices
AMPT
Adam6060
Battery48TL
EmuMeter
Trumpf
SystemControl
TruConvert
TruConvertAc
TruConvertDc
Protocols
StatusApi
SysTools
Time
Units
Utils
Victron
WebServer
doc
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
defaultaccount = "Kim"
|
||||
|
||||
[[accounts]]
|
||||
account = "innovenergy-ag"
|
||||
defaultZone = "ch-dk-2"
|
||||
endpoint = "https://api.exoscale.com/v1"
|
||||
environment = ""
|
||||
key = "EXOf67c5b528282988503ddab12"
|
||||
name = "Kim"
|
||||
secret = "KBFh5HvoSQcTtGYcWSm4Qn4m-WFutKe89UqsOdOL-ts"
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||
<!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-7-0 -->
|
||||
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<DebuggerSupport>false</DebuggerSupport>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
using System.Web;
|
||||
using HandlebarsDotNet;
|
||||
using InnovEnergy.App.RemoteSupportConsole;
|
||||
using InnovEnergy.App.VrmGrabber.Database;
|
||||
using InnovEnergy.Lib.Victron.VictronVRM;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using FILE=System.IO.File;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber;
|
||||
|
||||
public record Install(
|
||||
String Name,
|
||||
String Ip,
|
||||
UInt64 Vrm,
|
||||
String Identifier,
|
||||
String Serial,
|
||||
String EscapedName
|
||||
);
|
||||
|
||||
[Controller]
|
||||
public class Controller : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
[Route("/")]
|
||||
[Produces("text/html")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
var instList = Db.InstallationsAndDetails.Keys.ToList();
|
||||
if (instList.Count == 0) return new ContentResult
|
||||
{
|
||||
ContentType = "text/html",
|
||||
Content = "<p>Please wait page is still loading</p>"
|
||||
};
|
||||
|
||||
String source = @"<head>
|
||||
<style>
|
||||
tbody {
|
||||
background-color: #e4f0f5;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border: 2px solid rgb(200, 200, 200);
|
||||
letter-spacing: 1px;
|
||||
font-family: sans-serif;
|
||||
font-size: 0.8rem;
|
||||
position: absolute; top: 0; bottom: 0; left: 0; right: 0;
|
||||
}
|
||||
|
||||
td,
|
||||
th {
|
||||
border: 1px solid rgb(190, 190, 190);
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: left;
|
||||
}</style></head>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
{{#inst}}
|
||||
{{> installations}}
|
||||
{{/inst}}
|
||||
</tbody>
|
||||
</table>";
|
||||
|
||||
String partialSource =
|
||||
@"<tr><td>{{Name}}</td>
|
||||
<td><a target='_blank' href=http://{{Ip}}>{{Ip}}</a></td>
|
||||
<td><a target='_blank' href=https://vrm.victronenergy.com/installation/{{Vrm}}/dashboard>VRM</a></td>
|
||||
<td>{{Identifier}}</td>
|
||||
<td>{{Serial}}</td>
|
||||
<td><a target='_blank' href='https://salidomo.innovenergy.ch/d/ENkNRQXmk/installation?refresh=5s&orgId=1&var-Installation={{EscapedName}}&kiosk=tv'>Grafana</a></td></tr>";
|
||||
|
||||
Handlebars.RegisterTemplate("installations", partialSource);
|
||||
var template = Handlebars.Compile(source);
|
||||
var insts = instList.Select(i =>
|
||||
{
|
||||
return new Install(i.Name, Ip(i), i.IdSite, i.Identifier, Serial(i), HttpUtility.UrlEncode(i.Name));
|
||||
});
|
||||
|
||||
|
||||
var data = new
|
||||
{
|
||||
inst = insts
|
||||
};
|
||||
|
||||
var result = template(data);
|
||||
|
||||
return new ContentResult
|
||||
{
|
||||
ContentType = "text/html",
|
||||
Content = result
|
||||
};
|
||||
}
|
||||
|
||||
private String Ip(Installation installation)
|
||||
{
|
||||
|
||||
return VpnInfo.LookUpIp(installation.Identifier, Serial(installation)).Result ?? "Unknown";
|
||||
}
|
||||
|
||||
private String Serial(Installation installation)
|
||||
{
|
||||
return Db.InstallationsAndDetails[installation].MachineSerial() ?? "Unknown";
|
||||
}
|
||||
|
||||
// [HttpGet(nameof(GetInstallation))]
|
||||
// [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
|
||||
// public Object GetInstallation(UInt64 serialNumber)
|
||||
// {
|
||||
// var instList = Db.InstallationsAndDetails.Values.ToList();
|
||||
// foreach (var detailList in instList.Select((value, index) => new { Value = value, Index = index}))
|
||||
// {
|
||||
// if (detailList.Value.All(detail => detail.Json["idSite"]?.GetValue<UInt64>() != serialNumber)) continue;
|
||||
// var retour = Db.InstallationsAndDetails.Keys.ToList()[detailList.Index].Json;
|
||||
// retour["details"] = JsonSerializer.Deserialize<JsonArray>(JsonSerializer.Serialize(detailList.Value.Select(d => d.Json).ToArray()));
|
||||
// return retour;
|
||||
// }
|
||||
//
|
||||
// return new NotFoundResult();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// installation Name, ip (link uf gui), idSite (vrm link), identifier , machineserial (HQ...)
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using InnovEnergy.Lib.Victron.VictronVRM;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.DataTypes;
|
||||
|
||||
|
||||
public class Installation : TreeNode
|
||||
{
|
||||
|
||||
|
||||
public Installation()
|
||||
{
|
||||
}
|
||||
|
||||
public String Name { get; set; }
|
||||
// Settings
|
||||
public IReadOnlyList<Detail> Notes { get; set; }
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace InnovEnergy.App.VrmGrabber.DataTypes.Methods;
|
||||
|
||||
|
||||
public static class InstallationMethods
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using SQLite;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.DataTypes;
|
||||
|
||||
public abstract partial class TreeNode
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public virtual Int64 Id { get; set; }
|
||||
public String Information { get; set; } = ""; // unstructured random info
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using InnovEnergy.App.VrmGrabber.DataTypes;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.Database;
|
||||
|
||||
|
||||
public static partial class Db
|
||||
{
|
||||
public static Boolean Create(Installation installation)
|
||||
{
|
||||
// SQLite wrapper is smart and *modifies* t's Id to the one generated (autoincrement) by the insertion
|
||||
return Connection.Insert(installation) > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Threading.Tasks;
|
||||
using InnovEnergy.Lib.Utils;
|
||||
using InnovEnergy.Lib.Victron.VictronVRM;
|
||||
using SQLite;
|
||||
using static System.Text.Json.JsonSerializer;
|
||||
using Installation = InnovEnergy.App.VrmGrabber.DataTypes.Installation;
|
||||
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.Database;
|
||||
|
||||
|
||||
public static partial class Db
|
||||
{
|
||||
public static Dictionary<Lib.Victron.VictronVRM.Installation, IReadOnlyList<Detail>> InstallationsAndDetails;
|
||||
internal const String DbPath = "./db.sqlite";
|
||||
|
||||
|
||||
private static SQLiteConnection Connection { get; } = new SQLiteConnection(DbPath);
|
||||
public static TableQuery<Installation> Installations => Connection.Table<Installation>();
|
||||
public static void Init()
|
||||
{
|
||||
// used to force static constructor
|
||||
}
|
||||
|
||||
static Db()
|
||||
{
|
||||
// on startup create/migrate tables
|
||||
|
||||
Connection.RunInTransaction(() =>
|
||||
{
|
||||
// Connection.CreateTable<Installation>();
|
||||
});
|
||||
|
||||
InstallationsAndDetails = new Dictionary<Lib.Victron.VictronVRM.Installation, IReadOnlyList<Detail>>();
|
||||
|
||||
Observable.Interval(TimeSpan.FromMinutes(5))
|
||||
.ObserveOn(TaskPoolScheduler.Default)
|
||||
.SubscribeOn(TaskPoolScheduler.Default)
|
||||
.StartWith(0) // Do it right away (on startup)
|
||||
.Select(UpdateInstallationsAndDetailsFromVrm)
|
||||
.Select(t => t.ToObservable())
|
||||
.Concat()
|
||||
.Subscribe(d => InstallationsAndDetails = d, exception => exception.WriteLine());
|
||||
}
|
||||
|
||||
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
|
||||
private static async Task<Dictionary<Lib.Victron.VictronVRM.Installation, IReadOnlyList<Detail>>> UpdateInstallationsAndDetailsFromVrm(Int64 _)
|
||||
{
|
||||
var fileContent = await File.ReadAllTextAsync("./token.json");
|
||||
|
||||
var acc = Deserialize<AccToken>(fileContent);
|
||||
var user = VrmAccount.Token(acc.idUser, acc.token);
|
||||
var installations = await user.GetInstallations();
|
||||
return installations
|
||||
.Do(i=>i.Name.WriteLine())
|
||||
.ToDictionary(i => i, i => i.GetDetails().Result);
|
||||
}
|
||||
}
|
||||
|
||||
public class AccToken
|
||||
{
|
||||
public UInt64 idUser { get; init;}
|
||||
public String token { get; init;}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using InnovEnergy.App.VrmGrabber.DataTypes;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.Database;
|
||||
|
||||
|
||||
public static partial class Db
|
||||
{
|
||||
|
||||
public static Boolean Delete(Installation installation)
|
||||
{
|
||||
return Installations.Delete(i => i.Id == installation.Id) > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using InnovEnergy.App.VrmGrabber.DataTypes;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber.Database;
|
||||
|
||||
|
||||
public static partial class Db
|
||||
{
|
||||
|
||||
public static Installation? GetInstallationById(Int64? id)
|
||||
{
|
||||
return Installations
|
||||
.FirstOrDefault(i => i.Id == id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using InnovEnergy.App.VrmGrabber.Database;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
namespace InnovEnergy.App.VrmGrabber;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(String[] args)
|
||||
{
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", OpenApiInfo);
|
||||
c.UseAllOfToExtendReferenceSchemas();
|
||||
c.SupportNonNullableReferenceTypes();
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseHttpsRedirection();
|
||||
app.MapControllers();
|
||||
// app.MapGet("/", () => Controller.Index());
|
||||
app.Run();
|
||||
}
|
||||
|
||||
private static OpenApiInfo OpenApiInfo { get; } = new OpenApiInfo
|
||||
{
|
||||
Title = "InnovEnergy VRM Grabber",
|
||||
Version = "v1"
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Flurl.Http" Version="3.2.4" />
|
||||
<PackageReference Include="Handlebars.Net" Version="2.1.4" />
|
||||
<PackageReference Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
|
||||
<PackageReference Include="MailKit" Version="3.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.Identity.Core" Version="2.2.3" />
|
||||
<PackageReference Include="Microsoft.AspNet.Identity.Owin" Version="2.2.3" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Identity.Web" Version="1.26.0" />
|
||||
<PackageReference Include="Microsoft.Owin.Cors" Version="4.2.2" />
|
||||
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" Version="4.2.2" />
|
||||
<PackageReference Include="Microsoft.Owin.Security" Version="4.2.2" />
|
||||
<PackageReference Include="Microsoft.Owin.Security.Cookies" Version="4.2.2" />
|
||||
<PackageReference Include="Microsoft.Owin.Security.OAuth" Version="4.2.2" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
||||
<PackageReference Include="sqlite-net-sqlcipher" Version="1.9.141-beta" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.6" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters.Abstractions" Version="7.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Lib/Utils/Utils.csproj" />
|
||||
<ProjectReference Include="..\..\Lib\Victron\VictronVRM\VictronVRM.csproj" />
|
||||
<ProjectReference Include="..\RemoteSupportConsole\RemoteSupportConsole.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="wwwroot\index.html" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
import requests as requests
|
||||
from flask import Flask
|
||||
from json2html import json2html
|
||||
|
||||
app = Flask(__name__)
|
||||
serverUrl = "https://127.0.0.1:7087/api" #todo change me
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
json = requests.get(serverUrl + '/GetInstallationList', verify=False) #TODO VERIFY
|
||||
|
||||
if json.content == b'0':
|
||||
return "Still loading Installations"
|
||||
return json2html.convert(json = json.json(), escape=False)
|
|
@ -0,0 +1 @@
|
|||
{"idUser":55450,"token":"909379784fa601a52ab4756c1cc9690ecc769db4b661214f9b165eda20be9913"}
|
|
@ -73,6 +73,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{AED84693-C
|
|||
../.gitignore = ../.gitignore
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VrmGrabber", "App\VrmGrabber\VrmGrabber.csproj", "{4F9BB20B-8030-48AB-A37B-23796459D516}"
|
||||
EndProject
|
||||
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -184,6 +186,10 @@ Global
|
|||
{B816BB44-E97E-4E02-B80A-BEDB5B923A96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B816BB44-E97E-4E02-B80A-BEDB5B923A96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B816BB44-E97E-4E02-B80A-BEDB5B923A96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4F9BB20B-8030-48AB-A37B-23796459D516}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4F9BB20B-8030-48AB-A37B-23796459D516}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4F9BB20B-8030-48AB-A37B-23796459D516}.Debug|Any CPU.ActiveCfg = Release-Server|linux-arm
|
||||
{4F9BB20B-8030-48AB-A37B-23796459D516}.Debug|Any CPU.Build.0 = Release-Server|linux-arm
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{CF4834CB-91B7-4172-AC13-ECDA8613CD17} = {145597B4-3E30-45E6-9F72-4DD43194539A}
|
||||
|
@ -216,5 +222,6 @@ Global
|
|||
{C04FB6DA-23C6-46BB-9B21-8F4FBA32FFF7} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854}
|
||||
{4A67D79F-F0C9-4BBC-9601-D5948E6C05D3} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854}
|
||||
{B816BB44-E97E-4E02-B80A-BEDB5B923A96} = {DDDBEFD0-5DEA-4C7C-A9F2-FDB4636CF092}
|
||||
{4F9BB20B-8030-48AB-A37B-23796459D516} = {145597B4-3E30-45E6-9F72-4DD43194539A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../../InnovEnergy.Lib.props" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Protocols\Modbus\Modbus.csproj" />
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
<PropertyGroup>
|
||||
<Description>DBus Library</Description>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace InnovEnergy.Lib.Utils;
|
||||
|
||||
|
@ -7,7 +9,7 @@ public static class JsonNodeAccessors
|
|||
|
||||
|
||||
public static T Get<T>(this JsonNode n, String propName) => n[propName]!.GetValue<T>();
|
||||
|
||||
|
||||
|
||||
public static String GetString(this JsonNode n, String propName) => n.Get<String>(propName);
|
||||
public static Boolean GetBoolean(this JsonNode n, String propName) => n.Get<Boolean>(propName);
|
||||
|
@ -37,7 +39,19 @@ public static class JsonNodeAccessors
|
|||
}
|
||||
}
|
||||
|
||||
public static String? TryGetString(this JsonNode n, String propName) => n.TryGet<String>(propName);
|
||||
public static String? TryGetString(this JsonNode n, String propName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return n.TryGet<String>(propName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return n.TryGet<UInt64>(propName).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean? TryGetBoolean(this JsonNode n, String propName) => n.TryGet<Boolean>(propName);
|
||||
|
||||
public static UInt32? TryGetUInt32(this JsonNode n, String propName) => n.TryGet<UInt32>(propName);
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="../../InnovEnergy.Lib.props" />
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace InnovEnergy.Lib.Victron.VictronVRM;
|
|||
|
||||
public readonly partial record struct Installation(VrmAccount VrmAccount, JsonNode Json)
|
||||
{
|
||||
|
||||
public UInt64 IdSite => Json.GetUInt64("idSite");
|
||||
public UnixTime Created => Json.GetUInt32("syscreated").Apply(UnixTime.FromTicks);
|
||||
|
||||
|
@ -15,7 +16,7 @@ public readonly partial record struct Installation(VrmAccount VrmAccount, JsonNo
|
|||
public String Name => Json.GetString("name");
|
||||
public String Notes => Json.GetString("notes");
|
||||
public String PhoneNumber => Json.GetString("phonenumber");
|
||||
|
||||
public String Identifier => Json.TryGetString("identifier");
|
||||
// TODO: alternative way to handle settings? make them writeable here and have an UpdateInstallation function?
|
||||
// public String Name
|
||||
// {
|
||||
|
|
|
@ -37,7 +37,7 @@ public static class Requests
|
|||
.AppendPathSegment("users")
|
||||
.AppendPathSegment(account.UserId)
|
||||
.AppendPathSegment("installations")
|
||||
.WithHeader("X-Authorization", account.Auth);
|
||||
.WithHeader("x-authorization", account.Auth);
|
||||
}
|
||||
|
||||
public static IFlurlRequest TagsRequest(this VrmAccount account, UInt64 installationId)
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Utils/Utils.csproj" />
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
<Configurations>Debug;Release;Release-Server</Configurations>
|
||||
<Platforms>AnyCPU;linux-arm</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue