feat: wire up PowerMonitor DI registration and complete integration

Made-with: Cursor
This commit is contained in:
Marius
2026-03-17 13:01:37 +02:00
parent 42e8db4999
commit ba31ed6a45
2 changed files with 13 additions and 2 deletions
+2 -1
View File
@@ -4,7 +4,8 @@
"Default": "Warning", "Default": "Warning",
"Override": { "Override": {
"System.Net.Http.HttpClient": "Warning", "System.Net.Http.HttpClient": "Warning",
"NordPoolManager": "Information" "NordPoolManager": "Information",
"PowerMonitorManager": "Information"
} }
}, },
"WriteTo": [ "WriteTo": [
+11 -1
View File
@@ -14,6 +14,9 @@ using NetDaemon.Extensions.Tts;
using NetDaemon.Runtime; using NetDaemon.Runtime;
using NordPoolManager; using NordPoolManager;
using NordPoolManager.Interface; using NordPoolManager.Interface;
using PowerMonitorManager;
using PowerMonitorManager.Interface;
using PowerMonitorManager.Models;
#pragma warning disable CA1812 #pragma warning disable CA1812
@@ -24,7 +27,7 @@ try
.UseCustomLogging() .UseCustomLogging()
.UseNetDaemonRuntime() .UseNetDaemonRuntime()
.UseNetDaemonTextToSpeech() .UseNetDaemonTextToSpeech()
.ConfigureServices((_, services) => .ConfigureServices((context, services) =>
services services
.AddNetDaemonMqttEntityManagement() .AddNetDaemonMqttEntityManagement()
.AddAppsFromAssembly(Assembly.GetExecutingAssembly()) .AddAppsFromAssembly(Assembly.GetExecutingAssembly())
@@ -44,6 +47,13 @@ try
.AddTransient<INordPoolEntityService, NordPoolEntityService>() .AddTransient<INordPoolEntityService, NordPoolEntityService>()
.AddSingleton<ICheapestIntervalsFinder, CheapestIntervalsFinder>() .AddSingleton<ICheapestIntervalsFinder, CheapestIntervalsFinder>()
.AddSingleton<IBoilerControlService, BoilerControlService>() .AddSingleton<IBoilerControlService, BoilerControlService>()
.Configure<PowerMonitorOptions>(
context.Configuration.GetSection(PowerMonitorOptions.SectionName))
.AddNetDaemonApp<PowerMonitorInit>()
.AddSingleton<IPowerSensorDiscoveryService, PowerSensorDiscoveryService>()
.AddSingleton<IOtherPowerCalculationService, OtherPowerCalculationService>()
.AddSingleton<IPowerCostCalculationService, PowerCostCalculationService>()
.AddTransient<IPowerMonitorEntityService, PowerMonitorEntityService>()
) )
.Build() .Build()
.RunAsync() .RunAsync()