Sonoff Basic LED

I’m having trouble getting my Sonoff Basic LED to turn on/off with the relay. I can turn the relay on/off and the LED on/off. What I want is for the LED to turn on when the relay is switched on, and off when the relay is switched off.
My sonoff config:

switch:
  - platform: gpio
    name: "Sonoff 1 Relay"
    pin: GPIO12
    id: relay
  - platform: template
    name: "Sonoff 1 relay"
    optimistic: true
    id: relayandled
    turn_on_action:
    - switch.turn_on: relay
    - light.turn_on: led
    turn_off_action:
    - switch.turn_off: relay
    - light.turn_off: led      
    
output:
  - platform: esp8266_pwm
    id: sonoff_1_led
    pin:
      number: GPIO13
      inverted: True

light:
  - platform: monochromatic 
    name: "Sonoff 1 Green LED"
    output: sonoff_1_led
    id: led

And where are your esphome logs showing the problem?

Never mind. I solved it. The template platform (under “switch”) was named the same as the gpio platform (under “switch”). I renamed the template platform and that solved it.

1 Like

Thats great, would you please consider adding it to https://esphome-configs.io/