Hi, I want to virtualize a floor with all rooms with switches, lights etc. I haven’t even added all the devices from a room yet, but there are already 200 lines of code! So I searched and found the !include function and it works with configuration stuff in the in the /config/configuration.yaml, but not for lovelaces picture-elements.
I created a directory under ‘config/lovelace/elements’ with the files kitchen.yaml, stairwell.yaml, bedroom.yaml, etc.
So I tried to replace my old Picture Elements Card Configuration to follow, but it doesn’t work.
image: local/GroundPlan.jpg
type: picture-elements
elements: !include_dir_merge_list elements/
And a .yaml as example the stairwell.yaml looked like this.
- type: state-icon
icon: mdi:motion-sensor
entity: binary_sensor.sensor_flur_motion
tap_action:
action: toggle
style:
'--paper-item-icon-color': black
'--paper-item-icon-active-color': red
top: 76%
left: 18%
transform: translate(-50%, -50%) scale(1.5) rotate(-75deg)
- type: state-icon
entity: binary_sensor.sensor_flur_motion2
tap_action:
action: toggle
style:
'--paper-item-icon-color': grey
'--paper-item-icon-active-color': red
top: 63%
left: 37%
transform: translate(-50%, -50%) scale(1.8)
I also tried to ‘Raw configuration editor’ in lovelace. It looked like this.
title: Overview
views:
- title: GroundPlan
path: groundplan
badges: []
cards:
- !include /config/lovelace/elements/kitchen.yaml
- !include /config/lovelace/elements/stairwell.yaml
And a .yaml as a example.
- image: local/GroundPlan.jpg
type: picture-elements
elements:
- type: state-icon
icon: mdi:motion-sensor
entity: binary_sensor.sensor_flur_motion
tap_action:
action: toggle
style:
'--paper-item-icon-color': black
'--paper-item-icon-active-color': red
top: 76%
left: 18%
transform: translate(-50%, -50%) scale(1.5) rotate(-75deg)
- type: state-icon
entity: binary_sensor.sensor_flur_motion2
tap_action:
action: toggle
style:
'--paper-item-icon-color': grey
'--paper-item-icon-active-color': red
top: 63%
left: 37%
transform: translate(-50%, -50%) scale(1.8)
What did I do wrong? Is there even a way to refactor or split the code of one Picture Elements Card into different files?