Skip to content

Use current entity in state card conditions#51708

Merged
timmo001 merged 5 commits intodevfrom
entity_context_card_conditions
Apr 27, 2026
Merged

Use current entity in state card conditions#51708
timmo001 merged 5 commits intodevfrom
entity_context_card_conditions

Conversation

@piitaya
Copy link
Copy Markdown
Member

@piitaya piitaya commented Apr 24, 2026

Proposed change

Adds a "Current entity" option to the entity picker in state and numeric state visibility conditions. It shows up when editing a condition on a card that has a main entity (tile, entity, light, thermostat, entity badge, entity heading badge...). Selecting it makes the condition use whatever entity the card is bound to.

On the map card, the state picker in conditions now autocompletes from the entities configured on the card instead of a static list.

Screenshots

CleanShot 2026-04-27 at 15 29 01

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

Additional information

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

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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

To help with the load of incoming pull requests:

@piitaya piitaya added the Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Apr 24, 2026
@piitaya piitaya marked this pull request as ready for review April 24, 2026 16:45
@timmo001
Copy link
Copy Markdown
Member

image

Not sure if we need the extra dropdown here, wouldn't it be better to just automatically pick the entity and let the user change the option naturally? This adds an additional step that isnt necessary IMO

Copy link
Copy Markdown
Member

@timmo001 timmo001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also merge conflicts to resolve

@home-assistant home-assistant Bot marked this pull request as draft April 27, 2026 09:15
@home-assistant
Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@piitaya
Copy link
Copy Markdown
Member Author

piitaya commented Apr 27, 2026

@timmo001 Yeah, It can be an extra item at the beginning of the list of entity picker. I'll check that 🙂 And if selected, it set entity to undefined.

@piitaya piitaya force-pushed the entity_context_card_conditions branch from 8fec963 to f06c8af Compare April 27, 2026 11:52
@piitaya piitaya marked this pull request as ready for review April 27, 2026 13:27
@home-assistant home-assistant Bot requested a review from timmo001 April 27, 2026 13:27
Copy link
Copy Markdown
Member

@timmo001 timmo001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, I still think the entity could just auto set on add (and maybe prioritise the entity to the top of the list) but this is more descriptive of a "default" value to show as "Current entity"

Also a huge timesaver if you like to set visibility based on available state etc. for cards

@timmo001 timmo001 merged commit 80e37e7 into dev Apr 27, 2026
12 checks passed
@timmo001 timmo001 deleted the entity_context_card_conditions branch April 27, 2026 13:59
@piitaya
Copy link
Copy Markdown
Member Author

piitaya commented Apr 27, 2026

@timmo001 I like that we have 2 items in the list : one that set undefined and the other that set the entity id. Otherwise it's confusing.

Allowing undefined instead of auto-set the entity also improve the yaml usage.

@timmo001
Copy link
Copy Markdown
Member

Yeah makes sense, it doesnt dupe when searching so its good there too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants