Need help with how to configure a 30min before sunset trigger

Hi, how do i set up a rule that will trigger 30 min before the sunset.
I've specified my location in settings.

I tried to set up a rule that if my light sensor is lower than 100 lux and the time is 30 min before the sunset. It should then turn on my lamps.

bild

The minus is before right? and plus is after?
The issue i see here is that looking at my events, the sunset event isn't reported until it actually happens. So then its hard to have a condition that should happen 30 minutes before. So there must be another way to achieve this right?

Cheers Dawid

Right or wrong, I would probably do this the opposite way. Use your trigger as Time is Sunset - 30 minutes then your conditional would be If "Illuminance of Motion Sensor" is <100....

I think if your sensor were to report <100 at 31 minutes before Sunset and then not again until 29 minutes before Sunset, I don't think your rule would continue because time is not exactly 30 minutes before sunset. I think the way you have it setup right now, your sensor would have to report a value of <100 exactly at Sunset - 30 minutes so even if the report was seconds different, the action wouldn't continue.

As far as I know, the hub pulls sunrise/sunset times daily for the upcoming day so it will know the sunset time and therefore know when sunset - 30 minutes is.

3 Likes

Agree with @stephen_nutt.

S.

Oh ok, i have a rule where they turn on at sunset. But then gf complained that sometimes when
the weather is cloudy its getting dark and she wants the lights turned on. So i bought the sensor to help out with that :slight_smile:

I guess i did a thinking error, i just wanted to catch if my sensor was being less than 100 anytime between 30min before sunset until the sunset (at sunset the other rule kicks in).

Thanks for your feedback

I set mine up to use the "between times" feature: I chose between sunset-30 and sunset+30 in the conditional, triggering on the lux level. Works fine.

1 Like

In that case, go back to the order you did it but instead of doing a specific time, choose between 2 times

2 Likes

I did something similar with illuminance.

I have 3 HUE outdoor motion sensor that provide Illuminance.

I used @bptworld's Averaging Plus app, to average the illuminace of 2 of the three sensors (one is wonky and randomly delivers 0 illuminance levels in the middle of the day), This provides a little balancing of the illuminance data, as one of the sensors is at the front of the house, and the other is at the back.

Then, I set my trigger up to watch the average illuminance variable for "changed". Once triggered, the rule then looks at the time and the illuminance threshold, and as long as it is between 9am and 9:30pm, the remainder of the rule carries on. In my case I light up living room to 50% and kitchen island lights to a 30% level and leave them. I have an override button if I wish to keep the room dark.

This rule means that on cloudy/gray days (like today as it happens) my lighting rules light up the living room and kitchen whenever it gets dark. The Averager makes sure the lights don't cycle continuously, as it is set to average on a 1 min rate. I could extend it, but 1 minute usually seems to handle the odd sunbeam or passing cloud to pass by without affecting the average light.

If the clouds pass, and the average light outside raises to my threshold for the various rooms, the lights will turn off, and stay off until the threshold is hit again, perhaps if it gets cloudy again, or when evening hits.

Probably one of my favorite automations.

Note, I also use a global to set my threshold so I can change the threshold of alll my illuminance rules at once.

S

1 Like