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:
2026-11-30 11:52:06 +02:00
parent cf8c9434c8
commit 24729ee267
165 changed files with 2513 additions and 2470 deletions
+18 -17
View File
@@ -14,33 +14,34 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
public BoilerConfig ReadConfig()
{
var dailyHoursState = haContext.GetState(BoilerDailyHoursEntityId)?.State;
var dailyHours = double.TryParse(dailyHoursState, NumberStyles.Any, CultureInfo.InvariantCulture, out var dh) ? dh : DefaultDailyHours;
var dailyHours = double.TryParse(dailyHoursState, NumberStyles.Any, CultureInfo.InvariantCulture, out var dh)
? dh
: DefaultDailyHours;
var intervalCount = (int)(dailyHours * IntervalsPerHour);
if (intervalCount <= 0)
{
intervalCount = IntervalsPerHour;
}
if (intervalCount <= 0) intervalCount = IntervalsPerHour;
var priceCapState = haContext.GetState(BoilerPriceCapEntityId)?.State;
var priceCap = double.TryParse(priceCapState, NumberStyles.Any, CultureInfo.InvariantCulture, out var pc) && pc > 0 ? pc : double.MaxValue;
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, CultureInfo.InvariantCulture, out var readyByTime))
{
if (!string.IsNullOrEmpty(readyByState) &&
TimeSpan.TryParse(readyByState, CultureInfo.InvariantCulture, out var readyByTime))
deadline = DateTime.Today.Add(readyByTime);
}
var skipPriceCapState = haContext.GetState(SkipPriceCapEntityId)?.State;
var skipPriceCap = string.Equals(skipPriceCapState, SwitchOnState, StringComparison.OrdinalIgnoreCase);
if (logger.IsEnabled(LogLevel.Debug))
{
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);
var config = new BoilerConfig
{
@@ -49,7 +50,7 @@ public sealed class BoilerConfigReader(IHaContext haContext, ILogger<BoilerConfi
Deadline = deadline,
SkipPriceCap = skipPriceCap
};
return config;
}
}
}