Skip to content

Instantly share code, notes, and snippets.

@blacklight
Last active October 22, 2019 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacklight/89f7628835500b5a9f4099bb07829d58 to your computer and use it in GitHub Desktop.
Save blacklight/89f7628835500b5a9f4099bb07829d58 to your computer and use it in GitHub Desktop.
# Play the music when you say "play the music".
# Note the regex support: this hook will be triggered whether you
# say "play the music" or "play music".
event.hook.PlayMusicAssistantCommand:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play (the)? music"
then:
- action: music.mpd.play
# Play a specific radio on TuneIn when you say "play the radio"
event.hook.PlayRadioAssistantCommand:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play (the)? radio"
then:
- action: music.mpd.clear
-
action: music.mpd.play
args:
resource: tunein:station:s13606
# Play a playlist given the name
event.hook.SearchPlaylistVoiceCommand:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play playlist ${name}"
then:
-
action: music.mpd.load
args:
playlist: ${name}
# Play a song or album by an artist by saying "play <title> by <artist>"
event.hook.PlayTitleVoiceCommand:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play ${title} by ${artist}"
then:
- action: music.mpd.clear
-
action: music.mpd.search
args:
filter:
- artist
- ${artist}
- any
- ${title}
-
action: music.mpd.play
args:
resource: ${output[0]['file']}
# Synchronize the stream from the living room to the bedroom speaker
event.hook.SyncMusicToBedroom:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play music to (the)? bedroom"
then:
-
action: music.snapcast.mute
args:
host: living-room
client: bedroom
mute: False
-
action: music.snapcast.volume
args:
host: living-room
client: bedroom
volume: 90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment