-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 visibility option to sections (conditional section) #20805
Conversation
@@ -338,6 +342,7 @@ export class HaChartBase extends LitElement { | |||
options: this._createOptions(), | |||
plugins: this._createPlugins(), | |||
}); | |||
this._loading = false; |
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 we put this in a finally
block so an exception won't leave you in a forever loading state?
this._config = findLovelaceContainer(this._params.lovelaceConfig, [ | ||
this._params.viewIndex, | ||
this._params.sectionIndex, | ||
]) as LovelaceSectionRawConfig; |
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.
For another day, but I feel like we should be able to teach TS that passing an array with 2 numbers to findLovelaceContainer
always returns LovelaceSectionRawConfig
`ui.panel.lovelace.editor.edit_section.visibility.explanation` | ||
)} | ||
</ha-alert> | ||
<ha-card-conditions-editor |
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.
Hooray for composability 🎉
} | ||
this._clearMediaQueries(); | ||
this._listeners = createConditionMediaQueriesListeners( |
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.
btw is create the right word? attach
is more appropriate maybe?
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.
Swweeeeet
e3d7b5c
to
3021768
Compare
- update views page to include the background tab - update sections view to include background and conditions - move steps on adding cards and section and on deleting a section into separate procedures - related to home-assistant/frontend#20708 and home-assistant/frontend#20805
Proposed change
Adds the possibility to hide/show sections based on certains conditions. For example, you may want to only display a section on mobile, where you're at home and when the kitchen lights are on.
It uses the same conditions as condition cards (https://www.home-assistant.io/dashboards/conditional/#conditions-options) which are :
It's not a new section but a new
visibility
options in the section config.Example of UI configuration
Example of YAML configuration
Demo time 🎉
demo-section-visibility.mp4
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: