automation:
  - alias: Bedroom · Opple
    id: bedroom_opple
    use_blueprint:
      path: oppo_6_btn_switch.yaml
      input:
        action_sensor: sensor.opple_1_action

        button_1_single:
          - service: light.turn_off
            entity_id: light.master_bedroom

        button_2_single:
          - service: light.turn_on
            data_template:
              entity_id:
                - light.master_bedroom
              brightness_pct: >-
                {% if not is_state('input_select.bedroom_mode', 'day') %} 40 {% else %} 100 {% endif %}

        button_1_double:
          - service: light.turn_off
            entity_id: light.master_bedroom_main

        button_2_double:
          - service: light.turn_on
            data_template:
              entity_id: light.master_bedroom_main
              brightness_pct: "{{ is_state('input_select.bedroom_mode', 'day') | iif(100, 40) }}"

        button_1_triple:
          - service: light.turn_off
            entity_id:
              - light.bedside

        button_2_triple:
          - service: light.turn_on
            data_template:
              entity_id:
                - light.bedside
              brightness_pct: "{{ is_state('input_select.bedroom_mode', 'day') | iif(100, 40) }}"

        button_3_single:
          - service: media_player.media_play_pause
            entity_id: media_player.master_bedroom

        button_3_double:
          - service: script.sonos_join_tv

        button_3_triple:
          - service: script.sonos_join_bedroom

        button_3_release:
          - service: media_player.play_next
            entity_id: media_player.master_bedroom

        button_4_single:
          - service: script.music_play

        button_4_double:
          - service: script.music_play
            data:
              playlist: 'Starred'

        button_4_triple:
          - service: script.music_play
            data:
              playlist: 'Retro'

        button_5_single:
          - service: fan.turn_off
            entity_id: fan.philips_airpurifier

        button_6_single:
          - service: fan.turn_on
            entity_id: fan.philips_airpurifier
