Tweak rules for entity-filter card #25570
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking change
entity-filter
cards that specified an entity with a state_filter, and a global condition, will now use the state_filter rules for that entity instead of the condition. Previously those state_filter rules would be ignored.entity-filter
cards that specified both a global state_filter and a global condition, or had a single entity with a state_filter and a condition, will generate an error. Previously the state_filter would be silently ignored.Proposed change
We are currently missing support for the case where there is no global filter, but each entity has a
condition
line. We currently support this if each entity has astate_filter
, but surprisingly no such rule forcondition
.I think it should not be mandated that every entity must have a filter rule, this is unnecessarily restrictive. I feel we should allow a card where some entities don't have a filter (and are always shown), but then other entities may have a filter to be sometimes shown. I have also changed the rules to allow this. Now at least one entity must have an applied condition or filter.
Previously if we had a global
condition
, but an individual entity defined astate_filter
, that state_filter was ignored. This change always honors the local condition/filter specified on the entity over the global rule. Astate_filter
orcondition
on an entity always had priority over a globalstate_filter
, but not over a globalcondition
. This seems inconsistent.Add more descriptive errors describing what is wrong with the config. Throw an error if an entity defines both a
condition
and astate_filter
. Previously thatstate_filter
was ignored.Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: