Set Sonos source to Line-In?

Is there any way to set the source on Sonos devices?

I have a pair of Play:5’s that I want to set to Line-in ® when I turn on my TV.

Bumping this to provide the answer, since this is the top result for this question on Google.

The sources listed in HASS are your Sonos favorites as-of startup, but since you can’t favorite a line-in, you can’t use media_player.select_source. Instead, you’ll have to use media_player.play_media and tell Sonos which specific speaker’s line-in you want to use.

Getting the Source ID

Open the Sonos app, and visit Settings > About my Sonos System, then find the device whose Line-in you want to use. Look at the part of the serial number before the :, and remove any dashes. Your ID is: RINCON_XXXXXXXXXXXX01400 (replace the Xs with your serial number).

For example, if my serial was 01-23-45-67-89-AB:F, my ID would be RINCON_0123456789AB01400.

(Alternatively, just visit http://[sonos device id]:1400/status/zp and make note of the LocalUID.)

Using the ID

You can call media_player.play_media with the following:

entity_id: media_player.[...]
media_content_id: x-rincon-stream:RINCON_[...]
media_content_type: music

EDIT 2021: At some point media_content_type switched from “MUSIC” (uppercase) to “music” (lowercase). If you’re having any problems, try the opposite casing.


It was probably updated, cause for me it works with:

entity_id: media_player.sonos_arc
source: TV
1 Like

This works for me now, (possibly because it’s using the line-in from itself):

  - service: media_player.select_source
      entity_id: media_player.basement_sonos
      source: Line-in
  - service: media_player.media_play
      entity_id: media_player.basement_sonos
1 Like

Thank you! now we need to add ‘data’ with last upgrade:

    - service: media_player.select_source
        entity_id: media_player.salle_tv
        source: TV

Thanks for this, very helpful.

In case someone want to use this with Node-Red, here is the service node to call.

[{"id":"fe19f54a.0edbe","type":"api-call-service","z":"776f4844.419d2","g":"19f4a5c7.121f4a","name":"Vinyl to Salon","server":"3c58bfa4.fb4fb","version":3,"debugenabled":false,"service_domain":"media_player","service":"play_media","entityId":"","data":"{\"media_content_id\":\"x-rincon-stream:RINCON_XXXXXXXXX01400\",\"media_content_type\":\"music\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":120,"wires":[[]]},{"id":"3c58bfa4.fb4fb","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Thanks works great​:blush::muscle::muscle: