Hello,
I’m still quite new to HASS and learning my way around all the terminology and tricks.
I find myself repeating a lot of YAML config in my lovelace dashboards - is there anyway I can DRY this up a bit (I have a long list of shortcuts to my favourite playlists for my sonos gear).
Note two things that get repeated a lot:
-
button-card
config - like hide the name, set some styles, etc - the
entity_id
s
type: horizontal-stack
cards:
- type: 'custom:button-card'
name: Ibiza Playlist
show_entity_picture: true
show_name: false
aspect_ratio: 1/1
entity_picture: /local/playlists/cafedelmar.jpg
styles:
card:
- padding: 0
entity_picture:
- width: 100%
tap_action:
action: call-service
service: media_player.play_media
service_data:
media_content_id: 'https://open.spotify.com/...'
media_content_type: music
entity_id:
- media_player.office
- media_player.lounge
- type: 'custom:button-card'
name: Glitterbox
aspect_ratio: 1/1
show_entity_picture: true
show_name: false
entity_picture: /local/playlists/glitterbox.jpg
styles:
card:
- padding: 0
entity_picture:
- width: 100%
tap_action:
action: call-service
service: media_extractor.play_media
service_data:
media_content_id: 'https://soundcloud.com/...'
media_content_type: music
target:
entity_id:
- media_player.office
- media_player.lounge
...
Thanks in advance