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:
@@ -17,6 +17,7 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
|
||||
var dailyHours = double.TryParse(dailyHoursState, NumberStyles.Any, CultureInfo.InvariantCulture, out var dh) ? dh : DefaultDailyHours;
|
||||
|
||||
var intervalCount = (int)(dailyHours * IntervalsPerHour);
|
||||
|
||||
if (intervalCount <= 0)
|
||||
{
|
||||
intervalCount = IntervalsPerHour;
|
||||
@@ -24,9 +25,10 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
|
||||
|
||||
var priceCapState = haContext.GetState(BoilerPriceCapEntityId)?.State;
|
||||
var priceCap = double.TryParse(priceCapState, NumberStyles.Any, CultureInfo.InvariantCulture, out var pc) && pc > 0 ? pc : double.MaxValue;
|
||||
|
||||
|
||||
var deadline = DateTime.Today.AddDays(1);
|
||||
var readyByState = haContext.GetState(BoilerReadyByEntityId)?.State;
|
||||
|
||||
if (!string.IsNullOrEmpty(readyByState) && TimeSpan.TryParse(readyByState, out var readyByTime))
|
||||
{
|
||||
deadline = DateTime.Today.Add(readyByTime);
|
||||
@@ -35,15 +37,17 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
|
||||
var skipPriceCapState = haContext.GetState(SkipPriceCapEntityId)?.State;
|
||||
var skipPriceCap = string.Equals(skipPriceCapState, SwitchOnState, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
logger.LogDebug("Boiler config: intervals={Intervals}, priceCap={Cap}, skipPriceCap={Skip}, deadline={Deadline}",
|
||||
intervalCount, priceCap, skipPriceCap, deadline);
|
||||
logger.LogDebug("Boiler config: intervals={Intervals}, priceCap={Cap}, skipPriceCap={Skip}, deadline={Deadline}", intervalCount, priceCap, skipPriceCap, deadline);
|
||||
|
||||
return new BoilerConfig
|
||||
var config = new BoilerConfig
|
||||
{
|
||||
IntervalCount = intervalCount,
|
||||
PriceCap = priceCap,
|
||||
Deadline = deadline,
|
||||
SkipPriceCap = skipPriceCap
|
||||
};
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user