I am building a simple switch with two button and two LED to turn on/off a SONOFF switch.
I reach a issue that i don’t know how to reflect the switch status to the LED with startup.
Could someone can help to finish the LED part?
LED1 connecting to GPIO 5
LED2 connecting to GPIO 6
Button 1 connecting to GPIO 2
Button 2 connecting to GPIO 3
You can set up LEDs like this if that’s what you need?
Then after that you can add a toggle light action to your button.
But you might also want to import the state of the Sonoff to help keep everything syncronised - the leds can be interlocked with the true state of the Sonoff.
You need to give your lights an id too, then refer to this Id in your toggle action.
By the way, the benefit of using a monochromatic light over a binary light is you can dim them. Even if I just want an on/off I typically use a monochromatic so I can set a custom on brightness (and sometimes have different day/night brightness.)
OKOK, Thanks a lot for the advise, added id, the error gone
sorry, i just start to play esphome, and i just copy the code from webpage, so, it may be something wrong…