Hi! I’m using Home Assistant on Rpi4. I cant get my light level dependant automation to work properly.
I want some lights to turn on when my Philips Hue Motion Sensor detects light below 350 lux for 10 minutes.
As an example: I go to bed at night, light level is 1 lux. A car drives by and it’s lights bring light level over 350 lux, just for a second or two. Now the automation should not go off. It has to to be over 350 lux for 10 minutes. But no!
After 10 minutes the automation will go off and turn on my lights.
I have created a binary_sensor wich turns off below 350 lux to trig the automation. Earlier I had the automation to trig from numeric_state direct from the Hue sensor. Same result though.
Automation made from front end.
Your’e exactly right! But how can I avoid that? I want to turn on the lights if my light level has been under 350 lux for 10 minutes.
I don’t won’t them to go off just by a car at night or some cloud passing by obscuring the sun.
My issue appears at night. When the surrounding light level is below 350 lux.
I belive the issue is ”for 10 minutes”! What I have read, ”for” is how long time a certain criteria is fullfilled. In my case the light level.
If the light level has been under 350 lux ”for” 10 minutes, then the automation will go off.
I may very well have misunderstod that! In that case, can somebody tell me the correct way to do this?
If light levels go under 350 lux for 10 minutes, then turn on the lights. I’m sure it must be an easy way to do it. Or?
No, you don’t, because then every time a car drives past your light will come on 10 minutes later. You’ve got yourself mentally stuck in the wrong logic here and need to think about it differently.
I agree with Marc, we could just write the automation for you but that way you won’t learn from it.
Try writing it out, line by line as if you were explaining it to a child.
And at each step, write the real world conditions you expect to happen, in order for your automation to happen, bearing in mind what you don’t want to happen.
Once you have that, use it to explain to someone else.
Pick holes in it, kick it around, make sure it’s right.
Then you can look at code for that written description.
Another question, 350 lux is quite a lot of light, so when the sun is not bright enough you want the light on.?
That continuous light, that energy inefficient.
Ok so I have reread what you are asking, as has been stated already, what you are asking it to do, it is doing. What you need to do now is work out under what conditions it should do it. If you don’t want it going off randomly during the night either a time condition or an input_boolean to switch it off may be an idea, or just turn off the automation via another automation. Or perhaps you need a condition to only turn on if the light was above 350 for a minimum period of time before dropping below 350.
You have the beginning of your idea sorted, now you need to refine it.