Skip to content

Tweak rules for entity-filter card #25570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 26, 2025

Conversation

karwosts
Copy link
Contributor

@karwosts karwosts commented May 23, 2025

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 a state_filter, but surprisingly no such rule for condition.

  • 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 a state_filter, that state_filter was ignored. This change always honors the local condition/filter specified on the entity over the global rule. A state_filter or condition on an entity always had priority over a global state_filter, but not over a global condition. 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 a state_filter. Previously that state_filter was ignored.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
@bramkragten bramkragten enabled auto-merge (squash) May 26, 2025 13:15
@bramkragten bramkragten merged commit 9f5f100 into home-assistant:dev May 26, 2025
11 checks passed
@karwosts karwosts deleted the entity-filter-rules branch May 26, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants