Use Yeelight devices in scene

Hello everyone,

i am currently trying to embed my Yeelight lamps in scenes. With my Hue lamps, which are permanently connected to the power supply, I have no problems at all. Unfortunately the Yeelight lamps are not permanently connected to the power supply. I have smart power switches, which I can also control via home assistant.

Information: The Yeelights are connected via WLAN.

So I would like to say best:

  1. switch on the power for the Yeelights
  2. wait until they are available
  3. set the color of the Yeelight lamps

Unfortunately I can’t make any progress with this.
I tried to solve this by script and wait_template.
I tried to read the status of the Yeelight lamp with state_attr. Unfortunately they are not always set to unavailable but sometimes still on when the script is started.

Then I tried to do this by ping or by device tracker. Unfortunately this doesn’t work properly either.

Meanwhile I have the feeling that I just try wildly and don’t act strategically anymore.

What is the right way to solve something like this?

So again briefly summarized what I thought:

  • Scenes don’t work because I can’t wait for the Yeelight lamp there.
  • Therefore I would create a script which first starts the light switch.
  • Then I would wait per wait_template for any event
  • And then start the scene

Of course, it would be best if I didn’t have to wait 1 minute for the scene to start, when the Yeelight lamp is actually available after 5-15 seconds.

Thanks a lot for your help!