I’m trying to figure out what’s the best why to create an automation to turn lights on in a room when there’s motion and then turn the lights off when no motion is detected.
I used to have two separate automatons, one that detected motion and turned the lights on and another that detected no motion and turned the lights off and it worked, but seemed inefficient.
Recently I created one automation that turns on lights when motion is detected, then waits for a trigger of no motion detected and then turns the light off, it seems to work well but sometimes I have issues. I just discovered one automation that wasn’t firing even when motion was detected and then I disabled and re-enabled the automation and it started working again.
Here’s an example of the automation that wasn’t working until disable/enable:
I’m also concerned that if I reboot the server while one of these automations is running/waiting for trigger that it breaks the automation. Also what happens if I use the philip hue dimmer switch or alexa to turn the lights off while the automation is running? Maybe it is better to just have two separate simple automations so nothing is running or waiting?
Hoping some expert can chirp in and help me understand this.
Hey Guys, thanks for the help, I think this is exactly what I was looking for. Never would have thought to use States as triggers with If, Then, Else actions.
I think that blueprint has everything you could ever possibly ask for. Funny I was looking for something exactly like this but could only find very basic blueprints when I was searching, this blueprint should be at the top of any search results for motion activated lights.
I see there’s an option to have the lights turn on based on LUX levels, does anyone know if this option can be used to turn lights on to a certain brightness level based on LUX level? For example in my office I have a motion sensor that triggers the lights to turn on and I have a condition that checks what the current LUX level is then sets the lights to a certain brightness level. I only have two options if LUX is below 30 or above 30.
I’ve been trying to adapt the former examples you provided to use the above LUX conditions but maybe this blueprint could make things easier.
Ok I’ve played around with that blueprint and it doesn’t seem like I can have conditions to set the lights to a certain brightness based on the LUX level, too bad but I guess beggars can’t be choosers, there’s probably not that many people who want to set the brightness level based on LUX level. Back to editing the previous example I guess…
Does anyone know if you can do If, Then, If, Then, Else instead of If, Then, Else? I know very little about this stuff and the previous examples are all If, Then, Else. I would need “if LUX level is above 30 then set brightness to X, if LUX level is below 30 then set brightness to X, else lights turn off” does that make sense??
Again much appreciation for the help, this community always blows my mind with the amazing help you receive from others.
Check the trace history, and under the tab ‘automation config’ you will find the flat automation yaml, which you can copy/paste and then edit as you want
I think using the blueprint as a base would be a good idea but maybe too advanced for my skill set. I’ve played around with the previous examples and come up with my own solution that appears to be working, not sure if this is the best way to have multiple “If Then” actions:
I haven’t used home assistant yet. I keep planning on doing it when I get time and money. So I’m curious could you do something like have one automation that turns the light on and off to a saved light level. Then have a second automation that changes the saved light level and changes the light level if it is not off.
Hey,
I’ve been experimenting myself. Problem now is that i have a automation that works sometime and sometimes not and i can’t figure out why.
So first i want to share the automation and hope someone can spare some time to look in to it and give me, as a newby, some advise .
I will also mention the devices i use so maybe to hear if they are known to give problems.
The goal is a sensor activated light that consists of 2 light sources.
RGB lightbulb LIDL HG07834c
LIVARNO LUX SMARTLED strip HG06104 A
and the
TUYA ZG204 ZL sensor.
First the LUX is detected in the room to see if the lights need to go on.
Second the time is detected to see if the lights have to go to a 100% white during the daytime or a 25 % colored light during nighttime.
There is also a delay to turn the lights of after no movement was detected