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:
@@ -15,13 +15,13 @@ namespace ShowerMonitorManager;
|
||||
[NetDaemonApp]
|
||||
public sealed class ShowerMonitorInit
|
||||
{
|
||||
private readonly ILogger<ShowerMonitorInit> _logger;
|
||||
private readonly IHaContext _haContext;
|
||||
private readonly IScheduler _scheduler;
|
||||
private readonly IShowerDetectionService _detectionService;
|
||||
private readonly IExhaustFanControlService _fanControlService;
|
||||
private readonly IShowerMonitorEntityService _entityService;
|
||||
private readonly IExhaustFanControlService _fanControlService;
|
||||
private readonly IHaContext _haContext;
|
||||
private readonly ILogger<ShowerMonitorInit> _logger;
|
||||
private readonly ShowerMonitorOptions _options;
|
||||
private readonly IScheduler _scheduler;
|
||||
private readonly TimeProvider _timeProvider;
|
||||
|
||||
private volatile bool _cleanedUp;
|
||||
@@ -69,10 +69,7 @@ public sealed class ShowerMonitorInit
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(3));
|
||||
|
||||
if (_options.CleanupEntitiesOnStartup)
|
||||
{
|
||||
await _entityService.CleanupEntitiesAsync();
|
||||
}
|
||||
if (_options.CleanupEntitiesOnStartup) await _entityService.CleanupEntitiesAsync();
|
||||
|
||||
await _entityService.CreateEntitiesAsync();
|
||||
|
||||
@@ -158,9 +155,8 @@ public sealed class ShowerMonitorInit
|
||||
if (!bathroomHumidity.HasValue || !mainHomeHumidity.HasValue)
|
||||
{
|
||||
if (_logger.IsEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.LogDebug("Humidity sensor data unavailable (bathroom={Bathroom}, home={Home})", bathroomHumidity, mainHomeHumidity);
|
||||
}
|
||||
_logger.LogDebug("Humidity sensor data unavailable (bathroom={Bathroom}, home={Home})",
|
||||
bathroomHumidity, mainHomeHumidity);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -183,10 +179,8 @@ public sealed class ShowerMonitorInit
|
||||
await _entityService.UpdateEntitiesAsync(context);
|
||||
|
||||
if (_logger.IsEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.LogDebug("Poll: bathroom={Bath}%, home={Home}%, diff={Diff}%, state={State}",
|
||||
bathroomHumidity.Value, mainHomeHumidity.Value, Math.Round(differential, 1), state);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -198,11 +192,8 @@ public sealed class ShowerMonitorInit
|
||||
{
|
||||
var state = _haContext.GetState(entityId);
|
||||
|
||||
if (state?.State is null or "unavailable" or "unknown")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (state?.State is null or "unavailable" or "unknown") return null;
|
||||
|
||||
return double.TryParse(state.State, CultureInfo.InvariantCulture, out var value) ? value : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user