Default light effect

I added a light effects to a light I have. But in home assistant I always get to picked between None and the one I want. Is there anyway to remove None? I just want the effect I have to be the default thing. I don’t want Home assistant to be able pick anything else.

Or would I have to code my own light component to do that?

Or does it make sense to add default_effect or something similar in esphome that override None with that effect?

This is especially annoying because home assistant/esphome forget the effect if you turn off the light and then on it again.

1 Like

Easiest way is to set it in esphome.

How do I do that?

effect ( Optional , string, templatable): If set, will attempt to start an effect with the given name.

Probably at the point you turn it on, set the effect.

Maybe I’m missing something but yes it looks like I can choose effect when I turn on the light from esphome. But what if Home assistant turn on the light? I couldn’t find how to write a trigger that set the effect.

I think on turn_on will apply to ha as well.

Yes but then I would have to write special actions in Home Assistent right? So it will not happen when I just turn on a light. It will only happen when I run my special actions.

I don’t think so. Just try it. I can’t as I am away.

Actually I’ve had this problem before there are no light triggers in ESPhome.

Easiest way would be to write a small automation in home assistant. Trigger on the light turning on, action, set the effect.

After looking into the code I found that on_turn_on was recently added for lights in https://github.com/esphome/esphome/pull/1037 . So with that I should be able to do:

   on_turn_on:
      then:
        - light.control:
            id: indoor_light
            effect: Blink

Using docker esphome/esphome:dev I tried it and it compiles but I can’t try it on the real thing until tomorrow.

2 Likes

Nice!

In case someone finds this. I found a bug which makes it impossible to change the light it self. But I fixed it in https://github.com/esphome/esphome/pull/1219

2 Likes

Thank you!! :smiley: