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:
@@ -25,9 +25,9 @@ public sealed class MqttRecreateApp
|
||||
private static readonly string[] AppDaemonIdentifiers = ["appdaemon"];
|
||||
|
||||
private readonly IHaContext _haContext;
|
||||
private readonly ILogger<MqttRecreateApp> _logger;
|
||||
private readonly IMqttEntityManager _mqttEntityManager;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ILogger<MqttRecreateApp> _logger;
|
||||
|
||||
public MqttRecreateApp(
|
||||
IHaContext haContext,
|
||||
@@ -69,9 +69,7 @@ public sealed class MqttRecreateApp
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
if (_logger.IsEnabled(LogLevel.Information))
|
||||
{
|
||||
_logger.LogInformation("Recreate-all button created: {EntityId}", RecreateButtonEntityId);
|
||||
}
|
||||
|
||||
var button = new Entity(_haContext, RecreateButtonEntityId);
|
||||
button.StateChanges()
|
||||
@@ -204,21 +202,17 @@ public sealed class MqttRecreateApp
|
||||
var state = _haContext.GetState(NordPoolPriceEntityId);
|
||||
if (state?.Attributes is IDictionary<string, object> attributes &&
|
||||
attributes.TryGetValue("unit_of_measurement", out var value))
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
string s => s,
|
||||
JsonElement { ValueKind: JsonValueKind.String } je => je.GetString(),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_logger.IsEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.LogDebug(ex, "Could not read unit_of_measurement for {EntityId}", NordPoolPriceEntityId);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user