# We can get media_content_id from kodi web interface on port 8080 play_playlist: alias: Play PlayList description: Send one of pre-generated playlists to media player fields: media_player: name: Media Player description: "Media Player" required: true selector: entity: domain: media_player volume: name: Volume description: "Audio Volume: 0 - 1" default: 0.7 selector: number: min: 0 max: 1 step: 0.05 playlist: name: Playlist description: "PlayList to play" default: darksoft selector: select: options: - label: DarkSoft Collections value: darksoft - label: Asgard Music value: asgard - label: Asgard Downloads value: downloads - label: Custom value: custom custom: name: Custom description: "Location of custom playlist" default: [] selector: media: variables: subfolders: [ "Best", "French", "Russian", "Armenian", "Slavic", "Power", "Irish", "Instrumental" ] current: 'input_number.smartpi_playlist' vol: '{{ volume | default(0.7) | float }}' list: '{{ playlist | default("darksoft") }}' mode: restart sequence: - alias: Turn on player service: media_player.turn_on target: entity_id: '{{ media_player }}' - service: media_player.volume_set data: volume_level: '{{ vol }}' target: entity_id: '{{ media_player }}' - choose: - conditions: - condition: template value_template: '{{ list == "darksoft" }}' sequence: - if: - condition: template value_template: '{{ states(current) | float >= (subfolders | length) }}' then: - service: input_number.set_value data: value: 0 target: entity_id: '{{ current }}' - alias: Iterate Darksoft Playlists service: media_player.play_media target: entity_id: - '{{ media_player }}' data: media_content_type: DIRECTORY enqueue: play media_content_id: '{{ "/home/csa/Music/" + subfolders[states(current) | int] }}' - service: input_number.increment target: entity_id: '{{ current }}' # - delay: # seconds: 5 - service: media_player.shuffle_set data: shuffle: true entity_id: '{{ media_player }}' # - service: media_player.repeat_set # data: # repeat: all # entity_id: '{{ media_player }}' - conditions: - condition: template value_template: '{{ list == "asgard" }}' sequence: - alias: Play Asgard Music service: media_player.play_media target: entity_id: - '{{ media_player }}' data: media_content_type: DIRECTORY enqueue: play media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%246%243/" # - delay: # seconds: 5 - service: media_player.shuffle_set data: shuffle: true entity_id: '{{ media_player }}' # - service: media_player.repeat_set # data: # repeat: all # entity_id: '{{ media_player }}' - conditions: - condition: template value_template: '{{ list == "download" }}' sequence: - alias: Play Asgard Downloads service: media_player.play_media target: entity_id: - '{{ media_player }}' data: media_content_type: DIRECTORY enqueue: play media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%241%240/" # - delay: # seconds: 5 - service: media_player.shuffle_set data: shuffle: false entity_id: '{{ media_player }}' # - service: media_player.repeat_set # data: # repeat: off # entity_id: '{{ media_player }}' - conditions: - condition: template value_template: '{{ list == "custom" }}' sequence: - alias: Play Asgard Downloads service: media_player.play_media target: entity_id: - '{{ media_player }}' data: '{{ custom }}'