Hello,
I am trying to build something so my kids can listen to their favorite kids show on spotify (Captain Sharky). On spotify, this one giant playlist, containing episodes which are divided into a certain amount of tracks. (Story 1: 30 Tracks, Story 2: 27 Tracks, …).
The stories always start with a title called “Story X - pirate song”.
What I am struggeling with, is a “repeat until” sequence to skip through the tracks until the next “Story X - pirate song” track is found.
Is there a way of writing generics, like there is in SQL “pirate song”? I cannot find one.
(Piratenlied = German for “pirate song”)
Maybe someone can help me here:
- repeat:
until:
- condition: state
entity_id: media_player.kinderzimmer
attribute: media_title
state: Sharkys Piratenlied
sequence:
- service: media_player.media_next_track
data: {}
target:
entity_id: media_player.kinderzimmer
here is the entire code, if neccessary:
alias: hue switch button 1 --> sharky kinderzimmer
description: ''
trigger:
- device_id: ...
domain: hue
platform: device
type: repeat
subtype: 1
unique_id: ...
condition: []
action:
- if:
- condition: device
device_id: ....
domain: media_player
entity_id: media_player.kinderzimmer
type: is_playing
then:
- service: media_player.media_pause
data: {}
target:
device_id: ...
- device_id: ...
domain: mobile_app
type: notify
message: stop
title: stop
- stop: ''
- device_id: ...
domain: mobile_app
type: notify
message: volumn down sharky go
title: volumn down sharky go
- service: media_player.volume_mute
data:
is_volume_muted: false
target:
entity_id: media_player.kinderzimmer
- service: media_player.volume_set
data:
volume_level: 0.05
target:
entity_id: media_player.kinderzimmer
- service: media_player.play_media
target:
entity_id: media_player.kinderzimmer
data:
media_content_id: >-
spotify://.....
media_content_type: spotify://playlist
metadata:
title: Käpt'n Sharky - Alle Hörspiele
thumbnail: https://i.scdn.co/image/.....
media_class: playlist
children_media_class: track
navigateIds:
- {}
- media_content_type: spotify://library
media_content_id: spotify://.....
- media_content_type: spotify://current_user_playlists
media_content_id: spotify://....../current_user_playlists
- repeat:
until:
- condition: state
entity_id: media_player.kinderzimmer
attribute: media_title
state: Sharkys Piratenlied
sequence:
- service: media_player.media_next_track
data: {}
target:
entity_id: media_player.kinderzimmer
mode: single