Create light based of template instead of switch

Here the scenario… I have some fake candles that can be turned on/off with the press of a button.
That button is usually open and when pressed pulls it low.
Below configuration works great. It however shows ‘Candle 1’ as a switch (just like configured haha).
I would love to have it show as a light in HA though.
Using platform:template with a light does not seem to work.

Anyone has an idea how to change this? Currently I have a helper in HA to change the switch to a light.
Not the end of the world, but it would be nice to have it done natively in ESPHome.

switch:
  - platform: gpio
    id: candle1_io
    pin: 
      number: GPIO32
      inverted: true
      mode: OUTPUT_OPEN_DRAIN
  - platform: template
    name: Candle 1
    icon: mdi:candle
    optimistic: true
    turn_on_action:
    - switch.turn_on: candle1_io
    - delay: ${pulse_length}
    - switch.turn_off: candle1_io
    turn_off_action:
    - switch.turn_on: candle1_io
    - delay: ${pulse_length}
    - switch.turn_off: candle1_io

Set it as a light then, try this Binary Light — ESPHome

Have you seen this?

2 Likes