using BoilerMonitor.Models; using BoilerMonitorManager.Interface; using BoilerMonitorManager.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using NetDaemon.AppModel; namespace BoilerMonitorManager; public static class BoilerMonitorServiceRegistration { public static IServiceCollection AddBoilerMonitor(this IServiceCollection services, IConfiguration configuration) { var options = configuration .GetSection(BoilerMonitorOptions.SectionName) .Get() ?? new BoilerMonitorOptions(); // Always register: NordPool and other features resolve boiler tuning from HA entity state // even when the BoilerMonitor app itself is disabled. services.AddScoped(); if (!options.Enabled) { return services; } services .AddNetDaemonApp() .AddSingleton() .AddSingleton() .AddTransient() .AddSingleton() .AddSingleton(TimeProvider.System); return services; } }