Enable PowerMonitor limit enforcement and prune unused boiler/replay code

PowerMonitor now ships enabled with power-limit enforcement settings: watt limit, recovery and cooldown windows, and switch-off plus pause/restore entity lists.

Remove the unused BoilerRunTimeTracker, its DI registration and tests, the StatusCleanedUp constant, and the boiler replay runner; simplify BoilerConfigReader, control-service logging and entity parsing. Switch CostAccumulator to System.Threading.Lock, update the Shower exhaust fan service and tests, drop the legacy HistoryReplay/McpServer sources and reporting tooling, and expand AGENTS.md with the current project wiring and DI notes.
This commit is contained in:
2026-11-29 13:58:08 +02:00
parent f176a1b8fc
commit f0bbd4f10b
98 changed files with 306 additions and 4737 deletions
+13 -20
View File
@@ -8,43 +8,36 @@ using LightMonitorManager.Models;
namespace LightMonitorManager;
public sealed class LightControlService : ILightControlService
public sealed class LightControlService(
IHaContext haContext,
ILogger<LightControlService> logger,
IOptions<LightMonitorOptions> options)
: ILightControlService
{
private readonly IHaContext _haContext;
private readonly ILogger<LightControlService> _logger;
private readonly LightMonitorOptions _options;
public LightControlService(
IHaContext haContext,
ILogger<LightControlService> logger,
IOptions<LightMonitorOptions> options)
{
_haContext = haContext;
_logger = logger;
_options = options.Value;
}
private readonly LightMonitorOptions _options = options.Value;
public void TurnOnLight()
{
var sunState = _haContext.GetState(_options.SunEntityId)?.State;
var sunState = haContext.GetState(_options.SunEntityId)?.State;
if (!string.Equals(sunState, LightMonitorConsts.SunBelowHorizon, StringComparison.OrdinalIgnoreCase))
{
_logger.LogDebug("Sun is not below horizon (state={SunState}), skipping light turn on", sunState);
logger.LogDebug("Sun is not below horizon (state={SunState}), skipping light turn on", sunState);
return;
}
var lightState = _haContext.GetState(_options.LightEntityId)?.State;
var lightState = haContext.GetState(_options.LightEntityId)?.State;
if (string.Equals(lightState, LightMonitorConsts.LightOnState, StringComparison.OrdinalIgnoreCase))
{
_logger.LogDebug("Light {EntityId} is already on, skipping", _options.LightEntityId);
logger.LogDebug("Light {EntityId} is already on, skipping", _options.LightEntityId);
return;
}
_haContext.CallService("light", "turn_on", ServiceTarget.FromEntity(_options.LightEntityId));
_logger.LogInformation("Light {EntityId} turned ON (dark outside + person home)", _options.LightEntityId);
haContext.CallService("light", "turn_on", ServiceTarget.FromEntity(_options.LightEntityId));
logger.LogInformation("Light {EntityId} turned ON (dark outside + person home)", _options.LightEntityId);
}
}