Files
HomeAssistant/PowerMonitor.Manager/PowerMonitorServiceRegistration.cs
T
gitea_admin f0bbd4f10b Enable PowerMonitor limit enforcement and prune unused boiler/replay code
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.
2026-11-29 13:58:08 +02:00

34 lines
1.2 KiB
C#

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NetDaemon.AppModel;
using PowerMonitorManager.Interface;
using PowerMonitorManager.Models;
namespace PowerMonitorManager;
public static class PowerMonitorServiceRegistration
{
public static IServiceCollection AddPowerMonitor(this IServiceCollection services, IConfiguration configuration)
{
var options = configuration
.GetSection(PowerMonitorOptions.SectionName)
.Get<PowerMonitorOptions>() ?? new PowerMonitorOptions();
if (!options.Enabled)
{
return services;
}
services
.AddNetDaemonApp<PowerMonitorInit>()
.AddScoped<IPowerSensorDiscoveryService, PowerSensorDiscoveryService>()
.AddSingleton<IOtherPowerCalculationService, OtherPowerCalculationService>()
.AddSingleton<IPowerCostCalculationService, PowerCostCalculationService>()
.AddTransient<IPowerMonitorEntityService, PowerMonitorEntityService>()
.AddTransient<IPowerNotificationService, PowerNotificationService>()
.AddTransient<IPowerLimitEnforcementService, PowerLimitEnforcementService>();
return services;
}
}