This commit is contained in:
2026-06-28 13:58:35 +03:00
parent 8f45028715
commit e6bf8258bb
114 changed files with 4365 additions and 874 deletions
+2 -17
View File
@@ -36,7 +36,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
{
try
{
logger.LogInformation("Creating/re-registering MQTT entity: {EntityId}", nordPoolEntity.EntityId);
await entityManager.CreateEntityAsync(nordPoolEntity).ConfigureAwait(false);
}
catch (Exception ex)
@@ -51,9 +50,7 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
public async Task ResetEntitiesAsync(CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
logger.LogInformation("Resetting all NordPool entity states to defaults");
await Task.WhenAll(
ResetLastUpdateTimeAsync(),
ResetCurrentPriceAsync(),
@@ -62,8 +59,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
ResetTodayTomorrowPricesAsync(),
ResetCheapestIntervalsAsync()
).ConfigureAwait(false);
logger.LogInformation("All NordPool entity states reset to defaults");
}
private async Task ResetLastUpdateTimeAsync()
@@ -162,11 +157,7 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
}
var cheapestCount = ctx.CheapestIntervals?.Count ?? 0;
logger.LogInformation("Updating nordpool_current_price with value: {Price} {Unit}", priceValue, ctx.UnitOfMeasurement);
logger.LogInformation("Updating sensor.nordpool_today_prices with {Count} prices", todayPricesCount);
logger.LogInformation("Updating sensor.nordpool_tomorrow_prices with {Count} prices", tomorrowPricesCount);
logger.LogInformation("Updating sensor.nordpool_today_tomorrow_prices with {Count} merged prices", mergedPrices.Count);
logger.LogInformation("Updating sensor.nordpool_cheapest_intervals with {Count} intervals, is_now_cheap={IsNow}", cheapestCount, ctx.IsNowCheap);
var updateTasks = new[]
@@ -180,8 +171,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
};
await Task.WhenAll(updateTasks).ConfigureAwait(false);
logger.LogInformation("NordPool entities updated successfully. Today prices count: {TodayCount}, Tomorrow prices count: {TomorrowCount}", todayPricesCount, tomorrowPricesCount);
}
private async Task UpdateLastUpdateTimeAsync(string updateTimeState)
@@ -266,8 +255,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
{
var removeTasks = AllEntityIds.Select(entityManager.RemoveEntity);
await Task.WhenAll(removeTasks).ConfigureAwait(false);
logger.LogInformation("NordPool entities cleaned up successfully");
}
catch (Exception ex)
{
@@ -323,7 +310,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
try
{
await entityManager.SetEntityState(entityId, state).ConfigureAwait(false);
logger.LogDebug("Successfully set state for {EntityId}: {State}", entityId, state);
}
catch (Exception ex)
{
@@ -336,7 +322,6 @@ public sealed class NordPoolEntityService(IEntityManager entityManager, ILogger<
try
{
await entityManager.SetEntityAttributes(entityId, attributes).ConfigureAwait(false);
logger.LogDebug("Successfully set attributes for {EntityId}", entityId);
}
catch (Exception ex)
{