Automate Radio in the morning

I have a Google Display which I use as a bedside clock. I currently have a Google Home automation to play a local radio station in the morning (Tay FM), but recently its been hit and miss. For the last few weeks its not worked on Wednesdays even though it should and did before. This week it ONLY worked on Wednesday. If I manually ask it to play the station, it also fails.

So I figured, HA must be able to do this.

I have a direct URL that plays in VLC fine on my desktop but with this automation, the Google device pings but never plays the stream. I am using my office Google speaker for testing.

alias: Play Tay FM in the morning
description: ""
triggers:
  - trigger: time
    at: "06:30:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
conditions: []
actions:
  - target:
      entity_id: media_player.office_speaker
    data:
      media:
        media_content_id: http://www.radiofeeds.net/playlists/bauerflash.pls?station=tayfm-mp3
        media_content_type: audio/mp3
    action: media_player.play_media
mode: single

Is this a URL problem or something else? This station is not in Radio Browser unfortunately.

Your link is for a playlist file so the first thing to try is using playlist as the media content type.

I don’t have any Google Home devices, but I couldn’t get it to play using playlist on any of my media players. However, the action does work with the url for the feed found inside that playlist file:

http://edge-bauermz-03-gos2.sharp-stream.com/tayfm.mp3?aw_0_1st.skey=1766166877&aw_0_1st.playerid=BMUK_RPi

They’re using a time-based security key, so you’ll need to use a template to generate a current timestamp in your action:

action: media_player.play_media
data:
  media:
    media_content_id: >-
      {% set ts = now().timestamp() | int %}
      http://edge-bauermz-03-gos2.sharp-stream.com/tayfm.mp3?aw_0_1st.skey={{ts}}
    media_content_type: audio/mp3
target:
  entity_id: media_player.office_speaker

You’ll need to let it play to see if/when the security key expires.

1 Like

Thank you for the assistance. Don’t think I would have figured this out, certainly not this quickly. Configured it over the weekend and it worked this morning.