feat(netd): add code generation
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-05 16:17:14 -04:00
parent d311d5de3c
commit 2220fccf7a
6 changed files with 10579 additions and 7 deletions

View file

@ -1,2 +1,3 @@
obj
bin
NetDaemonCodegen

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,11 @@
},
"ConsoleThemeType": "Ansi"
},
"HomeAssistant": {
"Host": "homie.nelim.org",
"Port": 443,
"Ssl": true
},
"NetDaemon": {
"ApplicationConfigurationFolder": "./apps"
},

View file

@ -42,10 +42,17 @@ in {
environment.systemPackages = [
(pkgs.writeShellApplication {
name = "updateNuDeps";
runtimeInputs = [pkgs.dotnet-sdk_8];
runtimeInputs = with pkgs; [
dos2unix
dotnet-sdk_8
];
text = ''
# Update the codegen
dotnet tool update -g NetDaemon.HassModel.CodeGen
# Install codegen
dotnet tool install --create-manifest-if-needed NetDaemon.HassModel.CodeGen
# Run it
dotnet tool run nd-codegen -token "$(sed 's/HomeAssistant__Token=//' ${secrets.netdaemon.path})"
dos2unix ./HomeAssistantGenerated.cs
# Update all nugets to latest versions
regex='PackageReference Include="([^"]*)" Version="([^"]*)"'
@ -63,6 +70,7 @@ in {
${compiled.passthru.fetch-deps} .
alejandra .
rm -r "$FLAKE/.config"
'';
})
];

View file

@ -4,8 +4,7 @@ using NetDaemon.Extensions.Logging;
using NetDaemon.Extensions.Scheduler;
using NetDaemon.Extensions.Tts;
using NetDaemon.Runtime;
// Add next line if using code generator
//using HomeAssistantGenerated;
using HomeAssistantGenerated;
#pragma warning disable CA1812
@ -21,8 +20,7 @@ try
.AddAppsFromAssembly(Assembly.GetExecutingAssembly())
.AddNetDaemonStateManager()
.AddNetDaemonScheduler()
// Add next line if using code generator
// .AddHomeAssistantGenerated()
.AddHomeAssistantGenerated()
)
.Build()
.RunAsync()

Binary file not shown.