This commit is contained in:
2026-06-28 13:58:35 +03:00
parent 8f45028715
commit e6bf8258bb
114 changed files with 4365 additions and 874 deletions
@@ -29,7 +29,7 @@
</None>
</ItemGroup>
<Target Name="AfterPublishMessage" AfterTargets="Publish">
<Message Text="Publish done! Copy all content in directory: $(PublishDir) to the `/config/netdaemon4' folder for add-on or your custom folder to deploy." Importance="high"/>
<Message Text="Publish done! Copy all content in directory: $(PublishDir) to the `/config/netdaemon4' folder for add-on or your custom folder to deploy." Importance="high" />
</Target>
<ItemGroup>
@@ -58,5 +58,6 @@
<ProjectReference Include="..\LightMonitor.Models\LightMonitor.Models.csproj" />
<ProjectReference Include="..\BatteryMonitor.Manager\BatteryMonitor.Manager.csproj" />
<ProjectReference Include="..\BatteryMonitor.Models\BatteryMonitor.Models.csproj" />
<ProjectReference Include="..\LeakMonitor.Manager\LeakMonitor.Manager.csproj" />
</ItemGroup>
</Project>
@@ -4,8 +4,8 @@
"commandName": "Project",
"workingDirectory": "$(ProjectDir)",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "development",
"DOTNET_ENVIRONMENT": "development"
}
}
}
+14 -8
View File
@@ -9,16 +9,13 @@
"BoilerMonitorManager": "Information",
"ShowerMonitorManager": "Information",
"LightMonitorManager": "Information",
"BatteryMonitorManager": "Information"
"BatteryMonitorManager": "Information",
"LeakMonitorManager": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
}
"Name": "Console"
}
]
},
@@ -58,18 +55,27 @@
"Enabled": true,
"LightEntityId": "light.sonoff_1002214d40",
"SunEntityId": "sun.sun",
"PersonEntityIds": ["person.marius", "person.erika", "person.home_phone"]
"PersonEntityIds": ["person.marius", "person.erika"]
},
"BatteryMonitor": {
"Enabled": true,
"BatteryThresholdPercent": 5
},
"LeakMonitor": {
"Enabled": true,
"SensorEntityIds": [
"binary_sensor.aquarium_leak_sensor",
"binary_sensor.boiler_moisture"
],
"NotificationCooldownMinutes": 5
},
"PowerMonitor": {
"Enabled": false,
"MainMeterEntityId": "sensor.sonoff_100267d63f_power",
"PollIntervalSeconds": 1,
"SmoothingWindowSize": 10,
"AnomalyThresholdWatts": 500,
"AnomalyThresholdWatts": 500,
"HighPowerThresholdWatts": 6000,
"ExcludedSensorPatterns": [
"sensor.nordpool_*",
"sensor.powermonitor_*"
+11 -7
View File
@@ -25,17 +25,18 @@ using LightMonitorManager;
using LightMonitorManager.Models;
using BatteryMonitorManager;
using BatteryMonitorManager.Models;
#pragma warning disable CA1812
using LeakMonitorManager;
using LeakMonitorManager.Models;
try
{
await Host.CreateDefaultBuilder(args)
var app = Host.CreateDefaultBuilder(args)
.UseNetDaemonAppSettings()
.UseCustomLogging()
.UseNetDaemonRuntime()
.UseNetDaemonTextToSpeech()
.ConfigureServices((context, services) =>
{
services
.AddNetDaemonMqttEntityManagement()
.AddAppsFromAssembly(Assembly.GetExecutingAssembly())
@@ -55,6 +56,7 @@ try
.AddScoped<INordPoolPriceService, NordPoolPriceService>()
.AddTransient<INordPoolEntityService, NordPoolEntityService>()
.AddSingleton<ICheapestIntervalsFinder, CheapestIntervalsFinder>()
.AddScoped<INordPoolBoilerConfigProvider, NordPoolBoilerConfigProvider>()
.Configure<PowerMonitorOptions>(context.Configuration.GetSection(PowerMonitorOptions.SectionName))
.AddPowerMonitor(context.Configuration)
.Configure<BoilerMonitorOptions>(context.Configuration.GetSection(BoilerMonitorOptions.SectionName))
@@ -65,10 +67,12 @@ try
.AddLightMonitor(context.Configuration)
.Configure<BatteryMonitorOptions>(context.Configuration.GetSection(BatteryMonitorOptions.SectionName))
.AddBatteryMonitor(context.Configuration)
)
.Build()
.RunAsync()
.ConfigureAwait(false);
.Configure<LeakMonitorOptions>(context.Configuration.GetSection(LeakMonitorOptions.SectionName))
.AddLeakMonitor(context.Configuration);
})
.Build();
await app.RunAsync().ConfigureAwait(false);
}
catch (Exception e)
{