I set up an automation where when the Aqara FP2’s light sensor detects that the brightness of my living room drops below 30 lux, it will turn on a set of lights around the house. I also set it so that the automation only works in a certain time range of the day.
I set this up late last afternoon, and it worked just fine yesterday. However, for some reason, the automation won’t work today. The lux level has dropped under 30 lux, and yet none of the lights are on. I don’t even think that the automation is triggered. If I go into the automation,right click on it and hit run, then all the lights in the automation lights up, but when I check the traces, it just shows that I manually ran it.
Any idea what might be preventing it from triggering? I’m new to HA and I still have a lot to learn so please be patient with me I’ll try to provide as much info as possible, but if I’m missing anything or should share things by default when posting a new topic, please do let me know.
this was all after 3pm my time, sorry I realized none of my screenshots clearly shows that. And I don’t actually need it to trigger before 3pm, even if it gets dark since that will most likely be temporary due to cloud coverage.
My suggestion wasn’t to trigger before 3pm, but at 3pm.
The numeric state trigger fires when the value crosses the threshold. If it gets dark before 3pm and stays dark, your automation won’t run. Here’s a potential sequence:
14:55 - light level drops below 30lx. Automation triggers on light level but is blocked by the time condition.
That’s all that happens!
With my suggestion:
14:55 - light level drops below 30lx. Automation triggers on light level but is blocked by the time condition.
15:00 - Automation triggers on time and passes through both conditions.
On a lighter day:
15:00 - Automation triggers on time but is blocked by the light level condition as it’s still bright.
16:30 - light level drops below 30lx. Automation triggers on light level and passes through both conditions.
It triggers on either thing but requires both. In effect it runs when the second of the two conditions becomes true.
Just wanted to inform you that your suggestion works! The lights are now triggered by when its dark and after 3pm. Thanks a lot for your help! And thanks to you as well Rich!
Post code as correctly-formatted text not screenshots on a third-party service that shows me ads.
What isn’t working? What is the lux level at 07:00? If it’s below 500 nothing will happen as the trigger only fires at the instant that the lux level drops from above to below 500. Add a time trigger at 07:00.
Indentation is wrong on the code screenshot but I guess that’s a copy-paste error otherwise you wouldn’t have the UI version.
Thanks for the reply, and sorry about the screenshots. I’m new to the community, and this is my first post/question, so I wasn’t allowed to share images in the form.
The problem is that the lights don’t turn on when the lx value is below 500. I don’t need the time trigger, so I can remove it to simplify things.
I’ll say it for a third time: A numeric state trigger set to below: 500 will only trigger when the value changes from above 500 to below 500. If the value is already below 500, nothing will happen.
It works! Thank you for your help; it’s much appreciated. I will now try to optimize the logic to ensure it also turns off the lights when the lux value is high.