I thought this would be easy, but for the life of me I cannot come anywhere close. I want to set up several monochromatic lights each having a random on/off effect. I.e. they would fade on, stay on for some random seconds, fade off, stay off for some random seconds, repeat. Alternately, they could just fade to a low brightness, if “off” within an effect is an issue…
I get as far as having a light that does turn on/off from HA. I’ve toyed with versions of the effect below, which would be a fixed 3 second cycle, as the next step. The effect does nothing other than sometimes changing the state in HA (the physical light does nothing).
- platform: monochromatic
name: "Light1"
id: light_1
output: led_white_output_1
effects:
- lambda:
name: "Random On/Off"
lambda: |-
id(light_1).turn_on().set_brightness(1.0).set_transition_length(1000).perform();
esphome::delay_microseconds_safe(3000000);
id(light_1).turn_on().set_brightness(0.1).set_transition_length(1000).perform();
esphome::delay_microseconds_safe(3000000);
What am I doing wrong?