Fix selector filtering for entity not in state machine (#24772)

This commit is contained in:
Bram Kragten 2025-03-25 10:26:34 +01:00 committed by GitHub
parent 2ae70e9b54
commit eb7923fa49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -702,10 +702,13 @@ export const deviceMeetsTargetSelector = (
};
export const entityMeetsTargetSelector = (
entity: HassEntity,
entity: HassEntity | undefined,
targetSelector: TargetSelector,
entitySources?: EntitySources
): boolean => {
if (!entity) {
return false;
}
if (targetSelector.target?.entity) {
return ensureArray(targetSelector.target!.entity).some((filterEntity) =>
filterSelectorEntities(filterEntity, entity, entitySources)