Update
This commit is contained in:
@@ -24,6 +24,7 @@ public static class ReplayEntityMap
|
||||
"sensor.nordpool_cheapest_intervals",
|
||||
BoilerMonitorConsts.SkipPriceCapEntityId,
|
||||
BoilerMonitorConsts.BudgetOverrideEntityId,
|
||||
BoilerMonitorConsts.AutoManagementEntityId,
|
||||
BoilerMonitorConsts.BoilerDailyHoursEntityId
|
||||
];
|
||||
|
||||
@@ -46,6 +47,11 @@ public static class ReplayEntityMap
|
||||
return entities;
|
||||
}
|
||||
|
||||
public static IReadOnlyList<string> GetEntitiesRequiringAttributes() =>
|
||||
[
|
||||
"sensor.nordpool_cheapest_intervals"
|
||||
];
|
||||
|
||||
public static IReadOnlyList<string> GetAllEntities(
|
||||
string boilerPowerEntityId,
|
||||
string boilerSwitchEntityId,
|
||||
@@ -66,4 +72,38 @@ public static class ReplayEntityMap
|
||||
|
||||
return [.. all];
|
||||
}
|
||||
|
||||
public static (IReadOnlyList<string> MinimalEntities, IReadOnlyList<string> FullEntities) GetPartitionedEntities(
|
||||
string boilerPowerEntityId,
|
||||
string boilerSwitchEntityId,
|
||||
string bathroomHumidityEntityId,
|
||||
string mainHomeHumidityEntityId,
|
||||
string mainMeterEntityId,
|
||||
string sunEntityId,
|
||||
string lightEntityId,
|
||||
string[] personEntityIds)
|
||||
{
|
||||
var allEntities = GetAllEntities(
|
||||
boilerPowerEntityId, boilerSwitchEntityId,
|
||||
bathroomHumidityEntityId, mainHomeHumidityEntityId,
|
||||
mainMeterEntityId, sunEntityId, lightEntityId, personEntityIds);
|
||||
|
||||
var fullSet = new HashSet<string>(GetEntitiesRequiringAttributes(), StringComparer.OrdinalIgnoreCase);
|
||||
var minimal = new List<string>();
|
||||
var full = new List<string>();
|
||||
|
||||
foreach (var entity in allEntities)
|
||||
{
|
||||
if (fullSet.Contains(entity))
|
||||
{
|
||||
full.Add(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
minimal.Add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
return (minimal, full);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user