I love being able to edit the dashboard on the fly with the dashboard GUI, but 90% of the time I get into either a card’s code window or the entire raw configuration editor. But I still want to be able to use the GUI mode for that 10%. I would be extremely psyched if there was a way to include external files from the dashboard.
How can I have my cake and it eat too?
Examine this simple Lovelace (it works!), just create a new dashboard and replace its content with the following yaml.
A simple dashboard with 3 views, which has cards with entities:
views:
- title: Living room
cards:
- type: entities
entities:
- sensor.dehumidifier_esphome_version
- type: entities
entities:
- sensor.dehumidifier_r2_current
- sensor.dehumidifier_r2_voltage
- title: Master bath
cards:
- type: entities
entities:
- switch.mba_fan
- light.3baa2_mba_shower
- light.3baa4_mba_spotlight
- type: entities
entities:
- sensor.current_version
- sensor.mike_weight
- sensor.kitty_feeder_seconds
- title: Utility closet
cards:
- type: entities
entities:
- sensor.current_version
- sensor.mike_weight
- sensor.kitty_feeder_seconds
What I want to do is to be able to move any of the yaml to external files, whether it contains a single character or hundreds of lines. So cut out the text and save it to files where it can be reached, and you get something like this. Note the last line. I want to have certain views entirely inside an include file, because I have integrations that create the entire view It can update my lovelace automatically.
The same dashboard with include files:
views:
- title: Living room
cards:
- type: entities
entities:
- !include /config/lovelace/include/ver.yml
- type: entities
entities:
- sensor.dehumidifier_r2_current
- sensor.dehumidifier_r2_voltage
- title: Master bath
cards:
!include /config/lovelace/include/mba_entities.yml
#include an entire view that was generated by an integration. hey, as long as we are dreaming, allow comments to be saved!!
!include /config/lovelace/include/utility_closet.yml
Having some sort of pre-processer to pull in the include files would help for separation of concern and let you use GUI and YAML mode at the same time.