Single LED and NodeMCU

Hi,
I am trying to use a diffused LED (red) to indicate when my garage is open. LED on when open, closed = off. I am using a NodeMCU with ESPHome. I am really battling to get the bulb to light up like a light would. Could someone please point me in the right direction. Many thanks.

For the led first create an output.

 output:
   - platform: gpio
     id: gpio_led
     pin: 2

Then to turn it on

on_...:
  then:
    - output.turn_on: gpio_led

thank you, i will try that now :slight_smile:

I managed to come right with the below code. I saw with the “output” i couldn’t turn it on and off like i switch “the only way i know how to automate it”.
So i used the below code. Thank you though as you put me on the right track.
switch:

  • platform: gpio
    pin: 5
    name: “Garage1 LED”
  • platform: gpio
    pin: 14
    name: “Garage2 LED”
  • platform: gpio
    pin: 13
    name: “Garage3 LED”