input_text:
  bedroom_2_playlist:
    name: Bedroom playlist
    icon: mdi:spotify

automation:
  - alias: Bedroom · Bedside Second Switch
    use_blueprint:
      path: aqara_switch.yaml
      input:
        action_entity: sensor.bedroom_wall_switch_action
        click:
          - service: light.toggle
            data_template:
              entity_id: >-
                {% if is_state('input_select.bedroom_mode', 'day') %}
                  ['light.master_bedroom_main', 'light.bedside']
                {% else %}
                  light.bedside
                {% endif %}
              brightness_pct: 100

        double_click:
          - service: scene.turn_on
            entity_id: scene.bedroom_ambient_pink
          - service: media_player.unjoin
            entity_id: media_player.master_bedroom
          - service: media_player.play_media
            target:
              entity_id: media_player.master_bedroom
            data_template:
              media_content_type: "music"
              media_content_id: "{{ states('input_text.bedroom_2_playlist') }}"

        hold:
          - service: script.toggle_bedroom_mode
