ESPhome controlling relay

Hi all!

I am experiencing some problems using an ESP32 Devkit V1 to control a relay of type hfd27/005-s.
This is my wiring:
Blue is GPIO pin, white is 3.3V, red is 5V. The idea is to use the GPIO as reference, and the led go high when GPIO is high, causing the relay to “disconnect”. Led is connected using Normally Open connection. When GPIO is HIGH 3.3v should be supplied to the Led.

I have tested it on a separate ESP32 using Arduino C and it worked as intended. Meanwhile, when implemented in esphome it no longer works. When GPIO is HIGH nothing happens. If GPIO is still HIGH, I pull it out and put it right back in, the LED goes HIGH and goes LOW when GPIO is LOW. This means that for every GPIO HIGH I need to pull the cable and put it back in, which obviousily is not ideal. Any ideas or help would be much appreciated!

My esphome code:

  - platform: gpio
    pin: 27
    name: "led"
    id: led1
    restore_mode: ALWAYS_OFF

and to control switch:

- switch.turn_on: led1
- delay: 10s
- switch.turn_off: led1

Have tested it with just a led, without the relay, and then it worked aswell…
Led is just for debugging and testing. Intended use is a 3.3V submersible water pump.