Wemos D1 ESPHome control GPIO as LEDs

Hi!

I want to control some LED i connected in my Wemos on GPIO outputs (with a resistor).
That control will be from a sensor in HA (already configured and in a OLED diaplay).
If that sensor state is mode than a value, turn on a LED and so on…
Can anyone help please?
My code for now is this one:

sensor:

  • platform: homeassistant
    id: power_va
    entity_id: sensor.shelly_em_qe_channel_1_power
    internal: true

font:

  • file: ‘arial.ttf’
    id: font1
    size: 46

i2c:
sda: D2
scl: D1

display:

  • platform: ssd1306_i2c
    model: “SSD1306 64x48”
    reset_pin: D0
    address: 0x3C
    lambda: |-
    it.printf(0, 0, id(font1), “%.1f”, id(power_va).state/1000);

output:

  • platform: gpio
    pin: D0
    id: level_1

  • platform: gpio
    pin: D3
    id: level_2

  • platform: gpio
    pin: D4
    id: level_3

  • platform: gpio
    pin: D5
    id: level_4

  • platform: gpio
    pin: D6
    id: level_5

  • platform: gpio
    pin: D7
    id: level_6

  • platform: gpio
    pin: D8
    id: level_7

At least 4 of the IO pins that you picked have potential issues that can cause a failure to boot (D0,D3,D4 & D8). Take a look at Pinout Reference

OK, thanks!
But how can i make some if structures to test my sensor values from HA (in this case, power_va) and turn on/off some LEDs?

EDIT: The LEDs are conected to GPIO. :slight_smile: