Apply code formatting cleanup across monitor projects
- Reindent appsettings.json and the MSBuild project files - Collapse single-statement guard blocks and tidy using and member order - Normalize XML doc indentation and file endings - Reorder BatteryMonitor test-data helpers and move the exclusion tests into their own region - Carry the same formatting through the boiler config, control, entity and test files
This commit is contained in:
@@ -34,4 +34,4 @@ public static class PowerMonitorConsts
|
||||
public const string SwitchDomain = "switch";
|
||||
public const string TurnOnService = "turn_on";
|
||||
public const string TurnOffService = "turn_off";
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,6 @@ public sealed class CostAccumulator(DateTime now)
|
||||
private double _costDaily;
|
||||
private double _costMonthly;
|
||||
|
||||
private double _previous15Min;
|
||||
private double _previous1Hour;
|
||||
private double _previousDaily;
|
||||
private double _previousMonthly;
|
||||
|
||||
private DateTime _last15MinReset = now;
|
||||
private DateTime _last1HourReset = now;
|
||||
private DateTime _lastDailyReset = now;
|
||||
@@ -21,6 +16,11 @@ public sealed class CostAccumulator(DateTime now)
|
||||
|
||||
private bool _partialWindow = true;
|
||||
|
||||
private double _previous15Min;
|
||||
private double _previous1Hour;
|
||||
private double _previousDaily;
|
||||
private double _previousMonthly;
|
||||
|
||||
public void AddCost(double costIncrement, DateTime now)
|
||||
{
|
||||
lock (_lock)
|
||||
@@ -77,10 +77,7 @@ public sealed class CostAccumulator(DateTime now)
|
||||
_lastDailyReset = now;
|
||||
}
|
||||
|
||||
if (!IsNewMonthWindow(now, _lastMonthlyReset))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!IsNewMonthWindow(now, _lastMonthlyReset)) return;
|
||||
|
||||
_previousMonthly = _costMonthly;
|
||||
_costMonthly = 0;
|
||||
@@ -108,4 +105,4 @@ public sealed class CostAccumulator(DateTime now)
|
||||
{
|
||||
return now.Year != lastReset.Year || now.Month != lastReset.Month;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,4 @@ public sealed class CostSnapshot
|
||||
public double PreviousDaily { get; init; }
|
||||
public double PreviousMonthly { get; init; }
|
||||
public bool PartialWindow { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@ public sealed class PowerCalculationResult
|
||||
public double SmoothedOtherPowerWatts { get; init; }
|
||||
public string DataQuality { get; init; } = "ok";
|
||||
public IReadOnlyDictionary<string, double> DevicePowerReadings { get; init; } = new Dictionary<string, double>();
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@ public sealed class PowerMonitorOptions
|
||||
public int LimitCooldownSeconds { get; set; } = PowerMonitorConsts.DefaultLimitCooldownSeconds;
|
||||
public string[] EnforceSwitchOffEntityIds { get; set; } = [];
|
||||
public string[] PauseAndRestoreEntityIds { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,4 @@ public sealed class PowerUpdateContext
|
||||
public required int TrackedSensorCount { get; init; }
|
||||
public required IReadOnlyList<string> DegradedSensors { get; init; }
|
||||
public required string SystemStatus { get; init; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user