Skip to content

Instantly share code, notes, and snippets.

@daviddykeuk
Last active March 28, 2023 20:36
Show Gist options
  • Save daviddykeuk/9e60675cc26f64578f4f389092718a9d to your computer and use it in GitHub Desktop.
Save daviddykeuk/9e60675cc26f64578f4f389092718a9d to your computer and use it in GitHub Desktop.
blueprint:
name: Start music on input button
description: When an input button is pressed, start the associated music on the selected media player
domain: automation
input:
input_button_entity_id:
name: Input Button
description: The Input Button Entity ID
selector:
entity:
domain: input_button
song_url:
name: Song url
description: The spotify open url of the song to play
sonos_entity_id:
name: Sonos speaker
description: The entity ID of the sonos speaker to use
selector:
entity:
domain: media_player
shuffle:
name: Shuffle
description: Whether to shuffle the playlist
default: true
selector:
boolean:
trigger:
- platform: state
entity_id: !input input_button_entity_id
action:
- service: media_player.shuffle_set
data_template:
shuffle: !input shuffle
entity_id: !input sonos_entity_id
- service: media_player.play_media
data_template:
entity_id: !input sonos_entity_id
media_content_id: !input song_url
media_content_type: music
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment