Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Created August 3, 2021 09:06
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 raspberrypisig/3707128bbc29aad71809588c0b35a22d to your computer and use it in GitHub Desktop.
Save raspberrypisig/3707128bbc29aad71809588c0b35a22d to your computer and use it in GitHub Desktop.
alias: play-playlist
description: ''
trigger: []
condition: []
action:
- repeat:
while:
- condition: template
value_template: '{{ repeat.index <= states.sensor.files.attributes.number_of_files }}'
sequence:
- service: media_player.turn_on
target:
device_id: 0035877f6c3ea9b835bd94c467695e1b
- service: media_player.play_media
target:
device_id: 0035877f6c3ea9b835bd94c467695e1b
data:
media_content_type: audio/mp3
media_content_id: >-
media-source://media_source/local{{
states.sensor.files.attributes.file_list[repeat.index - 1] |
replace(states.sensor.files.attributes.path, '/') }}
- delay:
hours: 0
minutes: 0
seconds: 11
milliseconds: 0
- wait_template: '{{ is_state(''media_player.rumpus_room_speaker'', ''idle'') }}'
mode: single
alias: testrepeat
description: ''
trigger: []
condition: []
action:
- repeat:
while:
- condition: template
value_template: '{{ repeat.index <= states.sensor.files.attributes.number_of_files }}'
sequence:
- service: notify.persistent_notification
data:
title: moo
message: >-
media-source://media_source/local{{
states.sensor.files.attributes.file_list[repeat.index - 1] |
replace(states.sensor.files.attributes.path, '/') }}
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment