This commit is contained in:
2026-06-28 13:58:35 +03:00
parent 8f45028715
commit e6bf8258bb
114 changed files with 4365 additions and 874 deletions
+15 -4
View File
@@ -8,7 +8,12 @@ public class BoilerControlService(ILogger<BoilerControlService> logger) : IBoile
{
private const string SwitchOnState = "on";
public BoilerAction DetermineAction(bool isNowCheap, bool waterReady, string? currentSwitchState, bool budgetExhausted, bool budgetOverride)
public BoilerAction DetermineAction(
bool isNowCheap,
bool waterReady,
string? currentSwitchState,
bool budgetExhausted,
bool budgetOverride)
{
var isCurrentlyOn = string.Equals(currentSwitchState, SwitchOnState, StringComparison.OrdinalIgnoreCase);
var effectiveBudgetExhausted = budgetExhausted && !budgetOverride;
@@ -16,7 +21,9 @@ public class BoilerControlService(ILogger<BoilerControlService> logger) : IBoile
if (shouldBeOn && !isCurrentlyOn)
{
logger.LogInformation("Boiler should turn ON — cheap interval active, water not ready, budget available (current state: {State})", currentSwitchState);
logger.LogInformation(
"Boiler should turn ON — cheap interval active, water not ready, budget available (current state: {State})",
currentSwitchState);
return BoilerAction.TurnOn;
}
@@ -30,8 +37,12 @@ public class BoilerControlService(ILogger<BoilerControlService> logger) : IBoile
return BoilerAction.TurnOff;
}
logger.LogDebug("Boiler state unchanged: {State} (cheap={Cheap}, waterReady={WaterReady}, budgetExhausted={BudgetExhausted})",
currentSwitchState, isNowCheap, waterReady, effectiveBudgetExhausted);
logger.LogDebug(
"Boiler state unchanged: {State} (cheap={Cheap}, waterReady={WaterReady}, budgetExhausted={BudgetExhausted})",
currentSwitchState,
isNowCheap,
waterReady,
effectiveBudgetExhausted);
return BoilerAction.NoChange;
}