Add braces to single-statement guards and refactor NordPool price fetching

- Expand inline guard, return and logger blocks across the monitor services, init classes and tests
- Have INordPoolPriceService take a per-date fetch delegate and expose ParseAndAdjust, moving the HA fetch call into NordPoolInit so the service can be registered singleton
- Record the NordPool and boiler service lifetimes in AGENTS.md
- Drop the unused persisted-state argument from the boiler test data helper
This commit is contained in:
2026-12-01 11:59:31 +02:00
parent 24729ee267
commit 77458383d1
34 changed files with 336 additions and 93 deletions
+6
View File
@@ -45,8 +45,10 @@ public sealed class LeakMonitorInit
foreach (var sensorEntityId in _options.SensorEntityIds) SubscribeToLeakSensor(sensorEntityId);
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("LeakMonitor initialized, monitoring {Count} sensor(s)",
_options.SensorEntityIds.Length);
}
}
catch (Exception ex)
{
@@ -74,7 +76,9 @@ public sealed class LeakMonitorInit
});
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Subscribed to leak sensor {SensorId}", sensorEntityId);
}
}
internal void HandleStateChange(string sensorEntityId, StateChange change)
@@ -90,7 +94,9 @@ public sealed class LeakMonitorInit
else if (string.Equals(newState, LeakMonitorConsts.WaterClearedState, StringComparison.OrdinalIgnoreCase))
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Water leak cleared by {SensorId}", sensorEntityId);
}
_notificationService.DismissLeakAlert(sensorEntityId);
}