Map card editor: add UI for conditions#30247
Open
ildar170975 wants to merge 56 commits intohome-assistant:devfrom
Open
Map card editor: add UI for conditions#30247ildar170975 wants to merge 56 commits intohome-assistant:devfrom
ildar170975 wants to merge 56 commits intohome-assistant:devfrom
Conversation
Contributor
Author
MindFreeze
reviewed
Mar 27, 2026
| (stateObj?: HassEntity) => | ||
| [ | ||
| { name: "entity", selector: { entity: {} } }, | ||
| ...(this.no_entity |
Member
There was a problem hiding this comment.
no_entity should be passed to the memoized funditon
| (localize: LocalizeFunc) => | ||
| [ | ||
| { name: "entity", selector: { entity: {} } }, | ||
| ...(this.no_entity |
Member
There was a problem hiding this comment.
no_entity should be passed to the memoized funditon
Comment on lines
+240
to
+252
| const mockStateObj: HassEntity = { | ||
| entity_id: "device_tracker.xxx", | ||
| attributes: {}, | ||
| state: "home", | ||
| last_changed: "", | ||
| last_updated: "", | ||
| context: { | ||
| id: "", | ||
| user_id: null, | ||
| parent_id: null, | ||
| }, | ||
| }; | ||
| const states = getStates(this.hass, mockStateObj); |
Member
There was a problem hiding this comment.
This looks very hacky and fragile
Contributor
Author
There was a problem hiding this comment.
This code is taken from a test. OK, will try to compose a list of 4 states (home, not_home, unavailable, unknown) with translations manually.
Contributor
Author
There was a problem hiding this comment.
@MindFreeze Can you tell me, is there any way to get translated names for "home" & "not_home"? Frontend translations ("en.json") contains translations for a state-badge element - and I guess in many languages the strings are SHORTENED.
Update - found a way, I hope...
Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Proposed change
Added "conditions" UI (#29614).
Currently “conditions” UI for “state” & “numeric state” include an input field to select an entity.
This is meaningless for “filtering conditions” used for entities in:
-- Entity filter card
-- Map card
-- Badge filter
i.e. “conditions” UI for these cards (which does not exist yet) should not include that “entity” input field.
This PR adds a possibility to “not show” that “entity” input field in the “state” & “numeric state” conditions.
Also, for these “no entity” conditions, a “test” button was removed from a menu.
Screenshots
Note that for a "State" condition, a list is prefilled with possible values for
device_trackerentities (standard ones likehome/not_homeand zones):Since the state selector is not attached to some particular entity, the list is supposed to be empty, and a user has to input values manually (instead of selecting them from a list). Prefilling the list with possible values simplifies the job.
Of course, not only
device_tracker(orperson) entities can be placed on a map; for other domains a user will have to input values manually.For example, this condition only shows a
zone.homeentity (which has a state =2):Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
To help with the load of incoming pull requests: