@Syon @pduffin @Thonglor @Greek @Alex_Slaets
Here’s a better example, that plays a Radio Station instead of a TTS message.
The automation and service call is easy; the hard part is figuring out the radio station url to play, as the Radio browser integration does not supply this information. You have to go to the Radio Browser Search page to find the station information - use the “Search” box in the upper right on that link and search for the name (e.g. 96.1
). It’s not very user-friendly, but it will get you the information you need for the service call.
Once you find the radio station of choice, click it to view the details - it should look something like this:
The key piece of info you are looking for is the url
value; in the case of this example, the radio station name is 96.1 The River
and it’s url is https://stream.revma.ihrhls.com/zc1001
. You might also want to note the favicon
url, as it contains an icon image that can be used in a button list of favorites. Also note the UUID value (e.g. 62083e65-51f6-4428-acf7-37b3bfcf2bcb
) that is displayed in the page url (e.g. https://www.radio-browser.info/history/62083e65-51f6-4428-acf7-37b3bfcf2bcb
)
Once you have the url value, use it in an automation service call to play the station on the media player of your choice:
alias: TEST Browser Play Radio Station Media by URL
trigger: []
condition: []
action:
- service: media_player.play_media
alias: Play Radio Station on Home Office Google Chrome Browser
data:
media_content_id: https://stream.revma.ihrhls.com/zc1001
media_content_type: audio/aac
target:
entity_id: media_player.chrome_home_office
mode: single
You can also play by using the radio station UUID value. This value is displayed in the search web-site url. You have to use the media-source://radio_browser/<UUID>
format. This will instruct HA media browser to do a lookup of the UUID to get the url value like we used in the above service call. I prefer the URL method, as it saves the resources used by the HA media browser performing a lookup of the UUID to get the URL value.
alias: TEST Browser Play Radio Station Media UUID
trigger: []
condition: []
action:
- service: media_player.play_media
alias: Play Radio Station on Home Office Google Chrome Browser
data:
media_content_id: media-source://radio_browser/62083e65-51f6-4428-acf7-37b3bfcf2bcb
media_content_type: audio/aac
target:
entity_id: media_player.chrome_home_office
mode: single
UPDATE - a note about the media_content_type. You may need to adjust to one of the following values, if the audio/aac
value does not work for you. Most streaming radio stations transmit using the AAC codec, but some could use other formats. The formats are:
- MP3 -
audio/mpeg
- AAC -
audio/aac
- AAC+ -
audio/aac
- OGG -
application/ogg
The code used is displayed in the search web-site station details:
Hope it helps!