-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add tile card feature for input_select domain #16650
Add tile card feature for input_select domain #16650
Conversation
Could you add a screenshot to show how it would look like? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi 👋
Thanks for the contribution.
There are some missing points before merging it :
- Select entities must be supported too
- If there are many options, the texts will not fit. You should display a dropdown (but we didn't have one that fit the tile card for now 😔). And we can add an option
list | dropdown
so the user can select the desired display.
@@ -17,6 +18,7 @@ const TYPES: Set<LovelaceTileFeatureConfig["type"]> = new Set([ | |||
"vacuum-commands", | |||
"fan-speed", | |||
"alarm-modes", | |||
"input_select-options", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename it to select-options
and add support for select
entity too?
} | ||
|
||
private _schema = memoizeOne( | ||
(localize: LocalizeFunc, stateObj?: HassEntity) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(localize: LocalizeFunc, stateObj?: HassEntity) => | |
(stateObj?: HassEntity) => |
switch (schema.name) { | ||
case "options": | ||
return this.hass!.localize( | ||
`ui.panel.lovelace.editor.card.tile.features.types.alarm-modes.${schema.name}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`ui.panel.lovelace.editor.card.tile.features.types.alarm-modes.${schema.name}` | |
`ui.panel.lovelace.editor.card.tile.features.types.select-options.${schema.name}` |
export const supportsInputSelectOptionsTileFeature = (stateObj: HassEntity) => { | ||
const domain = computeDomain(stateObj.entity_id); | ||
return domain === "input_select"; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should support select
entities too.
(option) => | ||
this._config?.options?.includes(option) || | ||
this._config?.options === undefined || | ||
this._config?.options?.length === 0 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(option) => | |
this._config?.options?.includes(option) || | |
this._config?.options === undefined || | |
this._config?.options?.length === 0 | |
) | |
(option) => | |
this._config?.options?.includes(option) || | |
this._config?.options === undefined | |
) |
If options is empty we must display nothing.
.options=${options} | ||
.value=${value} | ||
@value-changed=${this._valueChanged} | ||
.ariaLabel=${options} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be a label, not options
I close this PR as it's replaced by #17971. |
Proposed change
This PR adds the option to select an option of an input_select entity.
With this users have an easy way to integrate input_selects into their dashboards.
Type of change
Example configuration
The feature in this PR does not need any additional configuration.
But to test this feature I added an
input_select
entity with the idinput_select.demo
and nameDemo
.This
input_select
has the optionsfoo
,bar
,baz
andqux
.Then I added a dashboard with this configuration:
Checklist
If user exposed functionality or configuration variables are added/changed: