Update
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user