Apply code formatting cleanup across the monitor projects

- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests
- Expand single-statement guards and loops into braced blocks
- Realign wrapped method arguments, chained calls and continuations
- Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty`
- Flatten the boiler config expression and reindent the remaining touched files
This commit is contained in:
2026-12-01 12:33:31 +02:00
parent 77458383d1
commit f919d6b25b
115 changed files with 3115 additions and 1959 deletions
+26 -17
View File
@@ -1,3 +1,5 @@
#region
using System.Globalization;
using System.Reactive.Concurrency;
using BoilerMonitor.Models;
@@ -12,6 +14,8 @@ using NordPool.Models;
using NordPoolManager.Interface;
using NordPoolManager.Models;
#endregion
namespace NordPoolManager;
[NetDaemonApp]
@@ -67,7 +71,10 @@ public class NordPoolInit
{
await Task.Delay(TimeSpan.FromSeconds(3));
if (_options.CleanupEntitiesOnStartup) await _entityService.CleanupEntitiesAsync();
if (_options.CleanupEntitiesOnStartup)
{
await _entityService.CleanupEntitiesAsync();
}
await _entityService.CreateEntitiesAsync(UnitOfMeasurement);
await _entityService.ResetEntitiesAsync();
@@ -78,6 +85,7 @@ public class NordPoolInit
catch (Exception ex)
{
_logger.LogError(ex, "Error initializing NordPool prices");
throw;
}
}
@@ -123,7 +131,7 @@ public class NordPoolInit
}
await _priceService.FetchPricesAsync(FetchPricesForDateAsync);
_priceService.UpdateCurrentPrice();
var boilerConfig = _boilerConfigProvider.GetCurrentConfiguration();
@@ -139,13 +147,13 @@ public class NordPoolInit
private async Task<NordPoolPrice> FetchPricesForDateAsync(DateOnly date)
{
var nordPoolPricesDto = await _services.Nordpool.GetPricesForDateAsync(
new NordpoolGetPricesForDateParameters
{
Areas = "LT",
ConfigEntry = NordPoolConsts.ConfigEntry,
Currency = "EUR",
Date = date
});
new NordpoolGetPricesForDateParameters
{
Areas = "LT",
ConfigEntry = NordPoolConsts.ConfigEntry,
Currency = "EUR",
Date = date
});
return _priceService.ParseAndAdjust(nordPoolPricesDto);
}
@@ -153,12 +161,13 @@ public class NordPoolInit
private void SubscribeToFetchPricesButton()
{
var button = new Entity(_haContext, NordPoolConsts.FetchPricesButtonEntityId);
button.StateChanges()
.Subscribe(_ =>
{
_logger.LogInformation("Fetch prices button pressed, triggering manual NordPool price update");
Task.Run(UpdatePricesAsync);
});
.Subscribe(_ =>
{
_logger.LogInformation("Fetch prices button pressed, triggering manual NordPool price update");
Task.Run(UpdatePricesAsync);
});
}
private void UpdateCheapestIntervals(BoilerConfig config)
@@ -198,9 +207,9 @@ public class NordPoolInit
_cheapestIntervalsFinder.IsCurrentIntervalCheap(CheapestIntervals, currentDateTime);
var nextCheapInterval = CheapestIntervals?
.Where(i => i.Start > currentDateTime)
.OrderBy(i => i.Start)
.FirstOrDefault();
.Where(i => i.Start > currentDateTime)
.OrderBy(i => i.Start)
.FirstOrDefault();
var context = new EntityUpdateContext
{