Update
This commit is contained in:
@@ -37,7 +37,9 @@ public sealed class EntityStateTools
|
||||
var allStates = await _client.GetAllStatesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
return FormatJson(allStates);
|
||||
}
|
||||
|
||||
var filtered = allStates.EnumerateArray()
|
||||
.Where(e => e.TryGetProperty("entity_id", out var eid) &&
|
||||
@@ -78,12 +80,16 @@ public sealed class EntityStateTools
|
||||
|
||||
if (entity.TryGetProperty("entity_id", out var eid) &&
|
||||
(eid.GetString()?.ToUpperInvariant().Contains(q) ?? false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entity.TryGetProperty("attributes", out var attrs) &&
|
||||
attrs.TryGetProperty("friendly_name", out var fn) &&
|
||||
(fn.GetString()?.ToUpperInvariant().Contains(q) ?? false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user