Improve check

This commit is contained in:
Paul Bottein 2024-03-12 17:59:37 +01:00
parent f5e6a65a37
commit 458cbd9c1f
No known key found for this signature in database

View File

@ -178,10 +178,16 @@ export function extractConditionEntityIds(conditions: Condition[]): string[] {
const entityIds: string[] = []; const entityIds: string[] = [];
for (const condition of conditions) { for (const condition of conditions) {
if (condition.condition === "numeric_state") { if (condition.condition === "numeric_state") {
if (typeof condition.above === "string") { if (
typeof condition.above === "string" &&
isValidEntityId(condition.above)
) {
entityIds.push(condition.above); entityIds.push(condition.above);
} }
if (typeof condition.below === "string") { if (
typeof condition.below === "string" &&
isValidEntityId(condition.below)
) {
entityIds.push(condition.below); entityIds.push(condition.below);
} }
} else if ("conditions" in condition && condition.conditions) { } else if ("conditions" in condition && condition.conditions) {