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:
@@ -1,3 +1,5 @@
|
||||
#region
|
||||
|
||||
using LeakMonitor.Models;
|
||||
using LeakMonitorManager.Interface;
|
||||
using LeakMonitorManager.Models;
|
||||
@@ -7,6 +9,8 @@ using NetDaemon.AppModel;
|
||||
using NetDaemon.HassModel;
|
||||
using NetDaemon.HassModel.Entities;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace LeakMonitorManager;
|
||||
|
||||
[NetDaemonApp]
|
||||
@@ -42,12 +46,15 @@ public sealed class LeakMonitorInit
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
foreach (var sensorEntityId in _options.SensorEntityIds) SubscribeToLeakSensor(sensorEntityId);
|
||||
foreach (var sensorEntityId in _options.SensorEntityIds)
|
||||
{
|
||||
SubscribeToLeakSensor(sensorEntityId);
|
||||
}
|
||||
|
||||
if (_logger.IsEnabled(LogLevel.Information))
|
||||
{
|
||||
_logger.LogInformation("LeakMonitor initialized, monitoring {Count} sensor(s)",
|
||||
_options.SensorEntityIds.Length);
|
||||
_options.SensorEntityIds.Length);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -63,17 +70,17 @@ public sealed class LeakMonitorInit
|
||||
var entity = new Entity(_haContext, sensorEntityId);
|
||||
|
||||
entity.StateChanges()
|
||||
.Subscribe(change =>
|
||||
{
|
||||
try
|
||||
{
|
||||
HandleStateChange(sensorEntityId, change);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error handling state change for {SensorId}", sensorEntityId);
|
||||
}
|
||||
});
|
||||
.Subscribe(change =>
|
||||
{
|
||||
try
|
||||
{
|
||||
HandleStateChange(sensorEntityId, change);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error handling state change for {SensorId}", sensorEntityId);
|
||||
}
|
||||
});
|
||||
|
||||
if (_logger.IsEnabled(LogLevel.Information))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user