The code below is working fine, once i turn on the switch in the UI. I would like to modify it so that the blinking starts on boot up of the esp32.
Also I’m trying to learn if there is a way to make the led blink while motion is detected? ([binary_sensor:036]: ‘PIR Sensor’: Sending state ON). or even based on the light (light intensity’: Sending state [somevalue] % )
Try with this on your blinker. I have never tried restore_mode with template though. restore_mode: ALWAYS_ON.
If it doesn’t work, you can turn it on at boot:
Thanks @Karosm, on_boot did the trick. Im still trying to figure out how to make it conditional for example when motion is detected. I have when through what is possible but does not seem the function. I tried binary_sensor.is_on: PIR.
It doesn’t work like that.
It’s the binary sensor that has to do the action.
on_press: (or on_click depending on the length of the trigger), and copy the automation you have on blinker.
@Karosm , thanks for pointing me in the right direction. I managed to get a led to blink on detection of motion, not sure if it’s the correct way as randomly the led doesn’t go out until the next motion gets triggered, but here it is. Regarding the pwm way I couldn’t find a way to customise the blink pattern as I have right now such as a short pulse on and a longer off.
Just can’t seem to make is happen via slow pwm the led flickers dim with random bright pulses. However I managed to fix the issue where in some instances the led does not switch off. I added a default - switch.turn_off: detectLed to the binary sensor. and now it’s behaving good.
Sorry for asking basic questions as I have started on my esp journey and trying to grasp the basic building blocks.
You can basically continue similar way with other triggers or try new ways.
There are so many ways of doing things, if slow pwm doesn’t work for some reason, you could try with light component for example.
Something like this (not tested).