feat: migrate boiler control implementation to BoilerMonitor namespace and add budget handling logic

This commit is contained in:
Marius
2026-03-24 15:29:59 +02:00
parent c4015277a3
commit 11c2574235
61 changed files with 3250 additions and 728 deletions
@@ -0,0 +1,15 @@
namespace BoilerMonitorManager.Models;
public record BoilerMonitorConfig
{
public string? BoilerPowerEntityId { get; init; }
public string? BoilerSwitchEntityId { get; init; }
public int? PollIntervalSeconds { get; init; }
public double? HeatingPowerThresholdWatts { get; init; }
public bool IsFullyConfigured =>
!string.IsNullOrWhiteSpace(BoilerPowerEntityId) &&
!string.IsNullOrWhiteSpace(BoilerSwitchEntityId) &&
PollIntervalSeconds is > 0 &&
HeatingPowerThresholdWatts is > 0;
}
@@ -0,0 +1,14 @@
namespace BoilerMonitorManager.Models;
public sealed class BoilerMonitorOptions
{
public const string SectionName = "BoilerMonitor";
public bool Enabled { get; init; } = true;
/// <summary>
/// When true, removes existing BoilerMonitor MQTT entities before recreating them on app startup.
/// Manual cleanup (e.g. HA button) is not affected.
/// </summary>
public bool CleanupEntitiesOnStartup { get; init; } = true;
}
@@ -0,0 +1,17 @@
namespace BoilerMonitorManager.Models;
public record BoilerMonitorUpdateContext
{
public required TimeSpan TodayRunTime { get; init; }
public required TimeSpan RemainingTime { get; init; }
public required double BudgetPercentage { get; init; }
public required bool BudgetExhausted { get; init; }
public required int SessionCount { get; init; }
public required double BudgetHours { get; init; }
public required bool IsCurrentlyHeating { get; init; }
public required bool WaterReady { get; init; }
public required string? BoilerSwitchState { get; init; }
public required double? BoilerPowerWatts { get; init; }
public required bool IsNowCheap { get; init; }
public required DateTime? NextCheapIntervalStart { get; init; }
}
@@ -0,0 +1,9 @@
namespace BoilerMonitorManager.Models;
public record PersistedBoilerState
{
public required TimeSpan AccumulatedRunTime { get; init; }
public required int SessionCount { get; init; }
public required string? SkipPriceCapState { get; init; }
public required string? BudgetOverrideState { get; init; }
}
@@ -0,0 +1,8 @@
namespace BoilerMonitorManager.Models;
public record RunTimeSnapshot
{
public required TimeSpan AccumulatedRunTime { get; init; }
public required int SessionCount { get; init; }
public required bool IsInSession { get; init; }
}