feat: add BatteryMonitor implementation with discovery, notification, and scheduling services

This commit is contained in:
Marius
2026-04-01 10:55:33 +03:00
parent 11c2574235
commit 6e4d684359
114 changed files with 22820 additions and 527 deletions
@@ -0,0 +1,69 @@
using BoilerMonitor.Models;
using LightMonitor.Models;
using NordPool.Models;
using ShowerMonitor.Models;
namespace HomeAssistant.HistoryReplay.Configuration;
public static class ReplayEntityMap
{
public static IReadOnlyList<string> GetNordPoolEntities() =>
[
"sensor.nordpool_kwh_lt_eur_3_10_0",
NordPoolConsts.CurrentPriceEntityId,
BoilerMonitorConsts.BoilerDailyHoursEntityId,
BoilerMonitorConsts.BoilerPriceCapEntityId,
BoilerMonitorConsts.BoilerReadyByEntityId,
BoilerMonitorConsts.SkipPriceCapEntityId
];
public static IReadOnlyList<string> GetBoilerEntities(string boilerPowerEntityId, string boilerSwitchEntityId) =>
[
boilerPowerEntityId,
boilerSwitchEntityId,
"sensor.nordpool_cheapest_intervals",
BoilerMonitorConsts.SkipPriceCapEntityId,
BoilerMonitorConsts.BudgetOverrideEntityId,
BoilerMonitorConsts.BoilerDailyHoursEntityId
];
public static IReadOnlyList<string> GetShowerEntities(string bathroomHumidityEntityId, string mainHomeHumidityEntityId) =>
[
bathroomHumidityEntityId,
mainHomeHumidityEntityId
];
public static IReadOnlyList<string> GetPowerEntities(string mainMeterEntityId) =>
[
mainMeterEntityId,
NordPoolConsts.CurrentPriceEntityId
];
public static IReadOnlyList<string> GetLightEntities(string sunEntityId, string lightEntityId, string[] personEntityIds)
{
var entities = new List<string> { sunEntityId, lightEntityId };
entities.AddRange(personEntityIds);
return entities;
}
public static IReadOnlyList<string> GetAllEntities(
string boilerPowerEntityId,
string boilerSwitchEntityId,
string bathroomHumidityEntityId,
string mainHomeHumidityEntityId,
string mainMeterEntityId,
string sunEntityId,
string lightEntityId,
string[] personEntityIds)
{
var all = new HashSet<string>();
foreach (var e in GetNordPoolEntities()) all.Add(e);
foreach (var e in GetBoilerEntities(boilerPowerEntityId, boilerSwitchEntityId)) all.Add(e);
foreach (var e in GetShowerEntities(bathroomHumidityEntityId, mainHomeHumidityEntityId)) all.Add(e);
foreach (var e in GetPowerEntities(mainMeterEntityId)) all.Add(e);
foreach (var e in GetLightEntities(sunEntityId, lightEntityId, personEntityIds)) all.Add(e);
return [.. all];
}
}
@@ -0,0 +1,19 @@
namespace HomeAssistant.HistoryReplay.Configuration;
public sealed class ReplayOptions
{
public const string SectionName = "Replay";
public DateTimeOffset StartTime { get; set; } = DateTimeOffset.UtcNow.AddDays(-1);
public DateTimeOffset EndTime { get; set; } = DateTimeOffset.UtcNow;
public ReplayMonitorFlags Monitors { get; set; } = new();
}
public sealed class ReplayMonitorFlags
{
public bool NordPool { get; set; } = true;
public bool Boiler { get; set; } = true;
public bool Shower { get; set; } = true;
public bool Power { get; set; } = true;
public bool Light { get; set; } = true;
}