feat: add PowerMonitor service registration and default configuration tests
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
"UseAttributeBaseClasses" : "false"
|
||||
},
|
||||
"PowerMonitor": {
|
||||
"Enabled": false,
|
||||
"MainMeterEntityId": "sensor.sonoff_100267d63f_power",
|
||||
"PollIntervalSeconds": 1,
|
||||
"SmoothingWindowSize": 10,
|
||||
"AnomalyThresholdWatts": 500,
|
||||
"AnomalyThresholdWatts": 500,
|
||||
"ExcludedSensorPatterns": [
|
||||
"sensor.nordpool_*",
|
||||
"sensor.powermonitor_*"
|
||||
|
||||
@@ -15,7 +15,6 @@ using NetDaemon.Runtime;
|
||||
using NordPoolManager;
|
||||
using NordPoolManager.Interface;
|
||||
using PowerMonitorManager;
|
||||
using PowerMonitorManager.Interface;
|
||||
using PowerMonitorManager.Models;
|
||||
|
||||
#pragma warning disable CA1812
|
||||
@@ -49,11 +48,7 @@ try
|
||||
.AddSingleton<IBoilerControlService, BoilerControlService>()
|
||||
.Configure<PowerMonitorOptions>(
|
||||
context.Configuration.GetSection(PowerMonitorOptions.SectionName))
|
||||
.AddNetDaemonApp<PowerMonitorInit>()
|
||||
.AddScoped<IPowerSensorDiscoveryService, PowerSensorDiscoveryService>()
|
||||
.AddSingleton<IOtherPowerCalculationService, OtherPowerCalculationService>()
|
||||
.AddSingleton<IPowerCostCalculationService, PowerCostCalculationService>()
|
||||
.AddTransient<IPowerMonitorEntityService, PowerMonitorEntityService>()
|
||||
.AddPowerMonitor(context.Configuration)
|
||||
)
|
||||
.Build()
|
||||
.RunAsync()
|
||||
|
||||
Reference in New Issue
Block a user