- id: hue_switch_garage_and_lights
  alias: Hue switch - garage og lys
  mode: restart

  trigger:
    - platform: device
      domain: hue
      device_id: 5f6b41e54f3226acd9c9ab54a3acb527
      type: initial_press
      subtype: 1
      id: open_garage
    - platform: device
      domain: hue
      device_id: 5f6b41e54f3226acd9c9ab54a3acb527
      type: long_press
      subtype: 1
      id: close_garage
    - platform: device
      domain: hue
      device_id: 5f6b41e54f3226acd9c9ab54a3acb527
      type: initial_press
      subtype: 4
      id: lights_off
    - platform: device
      domain: hue
      device_id: 5f6b41e54f3226acd9c9ab54a3acb527
      type: long_press
      subtype: 4
      id: lights_on

  action:
    - choose:
        - conditions:
            - condition: trigger
              id: open_garage
          sequence:
            - condition: state
              entity_id: binary_sensor.garageport
              state: "off"
            - service: cover.toggle
              target:
                entity_id: cover.anne

        - conditions:
            - condition: trigger
              id: close_garage
          sequence:
            - condition: state
              entity_id: binary_sensor.garageport
              state: "on"
            - service: cover.toggle
              target:
                entity_id: cover.anne

        - conditions:
            - condition: trigger
              id: lights_off
          sequence:
            - service: light.turn_off
              target:
                entity_id: light.alle_lys

        - conditions:
            - condition: trigger
              id: lights_on
          sequence:
            - service: light.turn_on
              target:
                entity_id: light.alle_lys
