After lots of banging my head against the wall for weeks trying to get this working I have found a way to reliably play a SiriusXM channel on Sonos via HA and associating that station with a button on a Lovelace dashboard, and it’s really not that hard. Note that I am using the SiriusXM Canada option in the Sonos App for this. It SHOULD work for others but I have no way of testing that.
Tons of thanks to the people involved in this post and in this one: Media Browser and Sonos Player - #22 by heartkingz. These really helped me get the ideas together for this solution.
These are the step-by-step instructions to get this working:
- If you haven’t associated your Sonos speakers with HA then do that first (that’s beyond the scope of this note and there are LOTS of examples to do that).
- If there is ANYTHING playing on your Sonos speakers make sure to stop it using HA before you start this configuration or else these notes won’t work.
- Make sure that the SiriusXM option is activated in the SONOS APP (on iOS) and that you are logged into the SiriusXM option and can play a SiriusXM station through your Sonos speakers via the SONOS APP.
- Get the SiriusXM station that you want playing on your Sonos speakers using the SONOS APP
- In HA, go to Developer Tools | States and select a Sonos speaker entity.
- Copy the entry for “media_content_id:” (excluding the words “media_content_id:” and the “>” if present). This is going to be an entry starting with “x-sonosapi-hls:Api%3…”
- Paste that content into the Content ID field of a Media Button Card (among others).
- Add “-static” to the entry so that it says “x-sonosapi-hls-static:Api%3…” (<=THIS IS CRITICAL)
- Set the Content Type to “music”
That’s it. It works!! (At least it does for me as of May 10, 2023).
This is using HA 2023.3.6 with Supervisor 2023.4.1 under HAOS 9.5.