feat: add BatteryMonitor implementation with discovery, notification, and scheduling services
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NetDaemon.AppModel;
|
||||
using LightMonitorManager.Interface;
|
||||
using LightMonitorManager.Models;
|
||||
|
||||
namespace LightMonitorManager;
|
||||
|
||||
public static class LightMonitorServiceRegistration
|
||||
{
|
||||
public static IServiceCollection AddLightMonitor(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var options = configuration
|
||||
.GetSection(LightMonitorOptions.SectionName)
|
||||
.Get<LightMonitorOptions>() ?? new LightMonitorOptions();
|
||||
|
||||
if (!options.Enabled)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
services
|
||||
.AddNetDaemonApp<LightMonitorInit>()
|
||||
.AddScoped<IPresenceService, PresenceService>()
|
||||
.AddScoped<ILightControlService, LightControlService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user