Cannot imitate ESPHome status led

I’m trying to somehow imitate the status led in a node, particularly when HA is down/off OR when wifi is off. The node’s led indeed starts blinking when no wifi is connected. But not when HA is down, for example when rebooting the host. Another node that I have with the status led enabled starts blinking as soon as I reboot the host. Is the below syntax correct? Particularly the not/or syntax.

interval:
  - interval: 2000ms
    then:
      - if:
          condition:
            not:    
              or:
                - wifi.connected:
                - api.connected:
          then:
            - light.turn_on:
                id: error_led
                flash_length: 160ms
                brightness: 100%
            - switch.turn_off:
                id: led
      - if:
          condition:
            and:
              - wifi.connected:
              - api.connected:
              - switch.is_on: relay
              - switch.is_off: led
          then:
            - switch.turn_on:
                id: led

Edit: Found it, I feel soooo noob, should be:

- if:
    condition:
       or:    
          not:
             - wifi.connected:
             - api.connected: