Sonos how to play source


I need help to automation play a source from my sonos playlist.

  • id: ‘1596473993885’
    alias: middag
    description: ‘’
    • entity_id: input_boolean.middag
      from: ‘off’
      platform: state
      to: ‘on’
    • data:
      entity_id: media_player.vardagsrum
      service: media_player.select_source
      mode: single

Hey Jojje,

first off, please format your code. To do so, put three backticks (```) before and after your code, it should even show you a warning if you don’t do that.
The reason why your code isn’t working is because you’re calling the service without data, so you tell it to select a source but not which one. Take a look at the documentation for the service call.
Also you probably want to use single quotes '.
The working automation should look like this:

id: '1596473993885'
alias: middag
description: ''
mode: single
  - platform: state
    entity_id: input_boolean.middag
    from: 'off'
    to: 'on'
condition: []
  - service: media_player.select_source
      entity_id: media_player.vardagsrum
      source: (your sources name)

Be aware that the source name is case-sensitive.