diff --git a/source/lovelace/yaml-mode.markdown b/source/lovelace/yaml-mode.markdown index 6b772bf1e40..91a757c7f36 100644 --- a/source/lovelace/yaml-mode.markdown +++ b/source/lovelace/yaml-mode.markdown @@ -23,8 +23,101 @@ When you make changes to `ui-lovelace.yaml`, you don't have to restart Home Assi To revert back to using the UI to edit your Lovelace interface, remove the `lovelace` section from your `configuration.yaml` and copy the contents of your `ui-lovelace.yaml` into the raw configuration section of Home Assistant and restart. +### Advanced configuration -As a super minimal example, here's the bare minimum you will need for this to work: +You can define multiple dashboards that all have their own YAML file, and add custom resources that are shared by all dashboards. + +```yaml +lovelace: + mode: yaml + # Include external resources only add when mode is yaml, otherwise manage in the resources in the lovelace configuration panel. + resources: + - url: /local/my-custom-card.js + type: module + - url: /local/my-webfont.css + type: css + # Add more dashboards + dashboards: + generated: + mode: yaml + filename: notexist.yaml + title: Generated + icon: mdi:tools + show_in_sidebar: true + require_admin: true + hidden: + mode: yaml + title: hidden + show_in_sidebar: false + filename: hidden.yaml +``` + +You can also add YAML dashboards when your main dashboard is UI configurated: +```yaml +lovelace: + mode: storage + # Add yaml dashboards + dashboards: + yaml: + mode: yaml + title: YAML + icon: mdi:script + show_in_sidebar: true + filename: lovelace.yaml +``` + +{% configuration Lovelace %} +mode: + required: true + description: "In what mode should the main Lovelace panel be, `yaml` or `storage` (UI managed)." + type: string +resources: + required: false + description: "List of resources that should be loaded when you use Lovelace. Only use this when mode is `yaml`." + type: list + keys: + url: + required: true + description: The URL of the resource to load. + type: string + type: + required: true + description: "The type of resource, this should be either `module` for a JavaScript module or `css` for a StyleSheet." + type: string +dashboards: + required: false + description: Additional Lovelace YAML dashboards. + type: map + keys: + mode: + required: true + description: "The mode of the dashboard, this should always be `yaml`. Dashboards in `storage` mode can be created in the Lovelace configuration panel." + type: string + filename: + required: true + description: "The file in your `config` directory where the Lovelace configuration for this panel is." + type: string + title: + required: true + description: "The title of the dashboard, will be used in the sidebar." + type: string + icon: + required: false + description: The icon to show in the sidebar. + type: string + show_in_sidebar: + required: false + description: Should this view be shown in the sidebar. + type: boolean + default: true + require_admin: + required: false + description: Should this view be only accessible for admin users. + type: boolean + default: false +{% endconfiguration %} + +As a super minimal example of a Lovelace dashboard config, here's the bare minimum you will need for it to work: ```yaml title: My Awesome Home @@ -39,17 +132,10 @@ views: Welcome to your **Lovelace UI**. ``` -A slightly more advanced example shows additional elements which can be used to customize your frontend. +A slightly more advanced example: ```yaml title: My Awesome Home -# Include external resources -resources: - - url: /local/my-custom-card.js - type: js - - url: /local/my-webfont.css - type: css - views: # View tab title. - title: Example