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:
@@ -1,66 +0,0 @@
|
||||
using BoilerMonitorManager.Interface;
|
||||
using BoilerMonitorManager.Models;
|
||||
|
||||
namespace BoilerMonitorManager;
|
||||
|
||||
public sealed class BoilerRunTimeTracker : IBoilerRunTimeTracker
|
||||
{
|
||||
private readonly Lock _lock = new();
|
||||
private TimeSpan _accumulatedRunTime = TimeSpan.Zero;
|
||||
private int _sessionCount;
|
||||
private bool _isInSession;
|
||||
|
||||
public void RecordPollResult(bool isHeating, TimeSpan pollInterval)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (isHeating)
|
||||
{
|
||||
_accumulatedRunTime += pollInterval;
|
||||
|
||||
if (!_isInSession)
|
||||
{
|
||||
_sessionCount++;
|
||||
_isInSession = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_isInSession = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RunTimeSnapshot GetSnapshot()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
return new RunTimeSnapshot
|
||||
{
|
||||
AccumulatedRunTime = _accumulatedRunTime,
|
||||
SessionCount = _sessionCount,
|
||||
IsInSession = _isInSession
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_accumulatedRunTime = TimeSpan.Zero;
|
||||
_sessionCount = 0;
|
||||
_isInSession = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void RestoreFromSnapshot(TimeSpan accumulatedRunTime, int sessionCount)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_accumulatedRunTime = accumulatedRunTime;
|
||||
_sessionCount = sessionCount;
|
||||
_isInSession = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user