Trying to get a single white LED to turn on and off

Hi All

It’s been a few years since I worked on ESPhome, and I’ve forgotten everything (but I’m picking it back up quite well), however, this has me stumped… now… It’s probably something simple that I can’t for the life of me see, and I’m hoping you can help me out.

What I am trying to do… I have an ornament that I made, and I want to put a Tea light into it (electronic, not hot flame) but I want the Tealight to be conected to Home assistant so I can have it set to turn on and off depending on time and if there is someoen in the room to see it.

si I have taken a Tealight and removed the LED, I’ve connected it to the GND and pin D7 on a D1 mini I then (after a lot of searching and trying) got the following flashed onto the D1 mini but I can’t find the LED in Home assistant anywhere… can anyone help me please?

esphome:
  name: grimmreaperflame
  friendly_name: Grimm Reaper Flame

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: *******

ota:
  - platform: esphome
    password: ***********

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Grimmreaperflame"
    password: **********

captive_portal:
    
output:
  - platform: esp8266_pwm
    id: grimmreaperled
    pin: D7

light:
  - platform: monochromatic
    name: "Grimm Reaper Flame"
    output: grimmreaperled
      

any and all help is greatly appreciated

I’ve been through the documentation and searched the forum but couldn’t find anything.

kind regards

Robin

I assume you got the polarity of the LED correct and you have added a current limiting resistor of about 220 ohm like this
gpio pin → resistor - led → gnd

Now remove output and light from your yaml and add this
where GPIOxx is the pin where you connect the resistor and LED
Since you use a D1 mini you can use something like D7

switch:
  - platform: gpio
    pin: D7  #GPIOXX
    name: "Grimm Reaper Flame""

This will get you started
More details here about GPIO

1 Like

Does it light across 3.3V and GND pin?

You flashed the device but did you also add it as an integration?

I knew it was something simple… I was so caught up in the ESPhome Yaml I forgot to tell Home Assistant it was there lol.

thank you :smiley:

1 Like

Say what?? No, that is for starters incorrect and secondly, it goes completely against all logic and common sense. When configured using Output and Light, it by default creates a Light entity in HA that works exactly like a Switch would where both have a toggle On/Off. The reason it makes no sense to actually configure it as a Switch is for 1 thing, it doesn’t change anything in HA except it was a Light class and now its a Switch class and by making it into a Switch you’ve lost the one huge benefit of using an led, you cant use a Switch to Dim anything but, you could have used the original Light entity for both toggle On/Off and to Dim as long as no one follows that backwards piece lf illogical advice you gave…

IdK even know how it is even possible to even think you should use a “Switch” to control an led “Light” because the reason there is a Light integration in Esphome is for configuring a LIGHT.

Maybe an example will make my point easier to understand. Here’s the correct way to configure any led/light in esphome and notice both On/Off toggle and a Slider to control brightness…

Now here is a Switch. Notice what’s missing from the Switch platform?? I think maybe you should take some time to read through your own Reading Assignments and actually use and work with different configuration setups to better understand what it is your telling people they should do, especially if you’re giving them bad instructions and just making things even harder for them

Well, while you completly right about using the light component, you also refuse to accept that there are other ways to achieve the requested on/off function. This in not wrong if you just want to turn on or off a led. Sadly I have only 35 years experience with microcontroller so who an I to say that the methode I suggested is the default way how to turn on/off a led connected to a gpio pin as said here.

So thumbs up for your good explanation. And a big no to your agressive choice if words.