I found several posts asking how to get the magic media_content_id:.
jjlawren posted the answer [Media player: Play media --> How to get the content ID? - #3 by jjlawren], but I found it still a bit cryptic. Today I went back to Radio_browser integration page. It still says
When creating an automation, use the Play Media action to pick a station from the directory.
I guess this hint gives a clue to experienced HA developers - but is far too subtle for new non-developers.
More detailed instructions are …
-
Going to Settings > Automations & Scenes > create automation > Create new automation.
-
In the New Automation page, under the “then Do” section, click [+ Add Action] .
-
On the Add action pop-up, select “media Player”, then the first “Play media” option - NOTE that there are 2 options both labelled “Play media” - you want the one with subtitle “Play media on media player”; and NOT the one with subtitle “Starts playing specified media”. You should now see:
-
Select your media player, then pick the media (audio) file you wish to play (it uses the HA Media Sources pop-up, so you can select local files (in the /media/ folder in HAOS, or a NAS share configured on Settings > System > Storage as a Media usage), Radio Browser (if installed), an installed Text-to-speech provider, … or I guess most anything installed in HA. It should now look similar to
-
Having selected the music to play, use the vertical 3-dots button to select the “Edit in YAML” option, and hey presto, there in the “data:” section is the media_content_id: that you can copy and paste into lovelace buttons, other automations, etc. There are also the title: and thumbnail: parameters provided by Radio Browaser.
Note that the same media selector is not available in the Developer Tools, where I had expected it.