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:
@@ -23,7 +23,9 @@ public class EntityManager(
|
||||
public async Task CreateEntityAsync(EntityCreateModel createModel)
|
||||
{
|
||||
if (createModel.EntityId != null)
|
||||
{
|
||||
await entityManager.CreateAsync(createModel.EntityId, createModel.Options, createModel.AdditionalConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetEntityState(string entityId, string state)
|
||||
@@ -66,9 +68,11 @@ public class EntityManager(
|
||||
{
|
||||
var separatorIndex = entityId.IndexOf('.');
|
||||
if (separatorIndex <= 0 || separatorIndex == entityId.Length - 1)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
$"Entity id '{entityId}' is not in the 'domain.object_id' format.",
|
||||
nameof(entityId));
|
||||
}
|
||||
|
||||
var domain = entityId[..separatorIndex];
|
||||
var objectId = entityId[(separatorIndex + 1)..];
|
||||
|
||||
Reference in New Issue
Block a user