Create a Script to play (multiple) Podcasts one after the other
-
find the rss url: google “{newsprovider} podcast rss”
(e.g. heise online (german): kurz informiert by heise online) -
add scrape sensors for each podcast (Link to Integrations: add integration – My Home Assistant)
- Resource: {rss url}
- NEXT
- Name: a name for the podcast url sensor
- Select:
enclosure
(might differ for you, but it was the same for 5 podcasts for me) - Index:
0
(latest episode) - Attribute:
url
(might also differ for you, but it was also the same for all for me) - SUBMIT
-
create a new Script (Link to Scripts – My Home Assistant)
- 3 dots top right → Edit in Yaml
- replace everything with this:
alias: Newsupdate sequence: # set volume for mediaplayer - service: media_player.volume_set metadata: {} data: volume_level: 0.5 # <-- set your volume level target: entity_id: media_player.CHANGEME # <-- change this to your mediaplayer # play 1st podast - service: media_player.play_media data: media_content_id: "{{ states.sensor.podcast_url1.state }}" # <-- change this to your first podcast scrape sensor media_content_type: episode target: entity_id: media_player.CHANGEME # <-- change this to your mediaplayer # wait for 1st podast to finish - wait_for_trigger: - platform: state entity_id: - media_player.CHANGEME # <-- change this to your mediaplayer from: playing to: idle continue_on_timeout: false timeout: minutes: 30 # play 2nd podast - service: media_player.play_media data: media_content_id: "{{ states.sensor.podcast_url2.state }}" # <-- change this to your second podcast scrape sensor media_content_type: episode target: entity_id: media_player.CHANGEME # <-- change this to your mediaplayer # (optional) add wait for 2nd and play 3rd (and so on) mode: restart icon: mdi:newspaper
- (optional) if you prefer the visual editor got back: 3 dots top right → Edit in Visual Editor
- change media_player.CHANGEME to your media player or group
- change volume level
- change media content id (get id from scrape sensor)
"{{ states.sensor.SCRAPE_SENSOR_ID.state }}"
- duplicate call service media player to add more podcasts
(remember to also keep the wait trigger between each service call to wait for the last podcast to finish)
Integration (for e.g. an action in an automation):
- Start/Play/Pause script
choose: - conditions: # if playing -> pause - condition: state entity_id: media_player.CHANGEME state: playing sequence: - service: media_player.media_pause target: entity_id: media_player.CHANGEME data: {} - conditions: # if paused -> play - condition: state entity_id: media_player.CHANGEME state: paused sequence: - service: media_player.media_play target: entity_id: media_player.CHANGEME data: {} - conditions: [] # else -> start newsupdate sequence: - service: script.newsupdate # your script id might differ data: {}
- Stop/Next script
# if playing and stopped -> wait for condition is triggered -> Next Podcast # if paused and stopped -> Nothing (media player changes to idle) service: media_player.media_stop metadata: {} data: {} target: entity_id: media_player.CHANGEME
- Skip 30 Seconds
# set media position to current_position+30 sequence: - service: media_player.media_seek metadata: {} data: seek_position: "{{ state_attr('media_player.CHANGEME ', 'media_position') + 30 }}" # change 30 to the amount of seconds to skip target: entity_id: media_player.CHANGEME
Feel free to post your additions/tweaks to this setup :)