dearly missing the native option for looping music media_files. we now have to resort to complexer scripts and automations like:
sound_bite:
alias: Sound bite
sequence:
- service: media_player.play_media
data_template:
entity_id: >
{{states('sensor.sound_bite_player')}}
media_content_id: >
{{states('sensor.sound_bite')}}
media_content_type: 'music'
play_sound_bite:
alias: Play sound bite
sequence:
- service: script.sound_bite
- delay:
seconds: >
{{state_attr(states('sensor.sound_bite_player'),'media_duration')|int}}
- condition: template
value_template: >
{{is_state('input_boolean.loop_sound_bite','on')}}
- service: script.play_sound_bite_loop
play_sound_bite_loop:
alias: Play sound bite loop
sequence:
- service: script.sound_bite
- delay:
seconds: >
{{state_attr(states('sensor.sound_bite_player'),'media_duration')|int}}
- condition: template
value_template: >
{{is_state('input_boolean.loop_sound_bite','on')}}
- service: script.play_sound_bite
this works, quite alright actually, though with a small gap between loops. But it would be very nice if we could simple do:
- service: media_player.loop_media <---- new service??
data_template:
entity_id: >
{{states('sensor.sound_bite_player')}}
media_content_id: >
{{states('sensor.sound_bite')}}
media_content_type: 'music'
and be done with it, no matter the file or file_length. Use case:
Alarm sound files repeated until snooze is hit
background music in scenarios
etc