blueprint:
  name: Sonos · Join to master
  domain: script
  input:
    join_player:
      name: Sonos player to join to master
      selector:
        device:
          integration: media_player

sequence:
  - service: media_player.join
    data_template:
      group_members: !input join_player
      entity_id: >-
        {% if is_state('binary_sensor.sonos_is_living_room_master', 'on') %}
          media_player.living_room
        {% else %}
          media_player.master_bedroom
        {% endif %}
