f0bbd4f10b
PowerMonitor now ships enabled with power-limit enforcement settings: watt limit, recovery and cooldown windows, and switch-off plus pause/restore entity lists. Remove the unused BoilerRunTimeTracker, its DI registration and tests, the StatusCleanedUp constant, and the boiler replay runner; simplify BoilerConfigReader, control-service logging and entity parsing. Switch CostAccumulator to System.Threading.Lock, update the Shower exhaust fan service and tests, drop the legacy HistoryReplay/McpServer sources and reporting tooling, and expand AGENTS.md with the current project wiring and DI notes.
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using NetDaemon.AppModel;
|
|
using ShowerMonitorManager.Interface;
|
|
using ShowerMonitorManager.Models;
|
|
|
|
namespace ShowerMonitorManager;
|
|
|
|
public static class ShowerMonitorServiceRegistration
|
|
{
|
|
public static IServiceCollection AddShowerMonitor(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var options = configuration
|
|
.GetSection(ShowerMonitorOptions.SectionName)
|
|
.Get<ShowerMonitorOptions>() ?? new ShowerMonitorOptions();
|
|
|
|
if (!options.Enabled)
|
|
{
|
|
return services;
|
|
}
|
|
|
|
services
|
|
.AddNetDaemonApp<ShowerMonitorInit>()
|
|
.AddSingleton<IHumidityRateCalculator>(_ => new HumidityRateCalculator(options.RateWindowSize))
|
|
.AddSingleton<IShowerDetectionService, ShowerDetectionService>()
|
|
.AddScoped<IExhaustFanControlService, ExhaustFanControlService>()
|
|
.AddTransient<IShowerMonitorEntityService, ShowerMonitorEntityService>();
|
|
|
|
return services;
|
|
}
|
|
}
|