5777e641f6
- Extract per-monitor *TestData helper classes and rework tests to use them - Add boiler run-time tracker abstraction (implementation pending) - Drop unused NordPool init/update-result types and stale PLAN.md - Add qodana.yaml with the inspection set to keep the analysis focused
29 lines
1.1 KiB
C#
29 lines
1.1 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();
|
|
|
|
services
|
|
.AddNetDaemonApp<PowerMonitorInit>()
|
|
.AddScoped<IPowerSensorDiscoveryService, PowerSensorDiscoveryService>()
|
|
.AddSingleton<IOtherPowerCalculationService, OtherPowerCalculationService>()
|
|
.AddSingleton<IPowerCostCalculationService, PowerCostCalculationService>()
|
|
.AddTransient<IPowerMonitorEntityService, PowerMonitorEntityService>()
|
|
.AddTransient<IPowerNotificationService, PowerNotificationService>()
|
|
.AddTransient<IPowerLimitEnforcementService, PowerLimitEnforcementService>();
|
|
|
|
return services;
|
|
}
|
|
}
|