# Periodic Trigger - Every n-minutes between sunset and sunrise

Anybody know a way to make a periodic trigger between two times. For example, if I wanted a rule to trigger every 15 minutes between sunset and sunrise, is there a way to do this?

The first way that comes to mind for me is trigger every 15 minutes then exit if not between sunrise and sunset.

Thanks, for the reply. That is exactly what I am currently doing, was just wondering if there is a way to define a periodic trigger between two times so that initial condition check is not required.

I could trigger at sunset, sunset+15min, sunset+30min, .... , sunset+600min. I imagine this would give me a trigger every 15 minutes after sunset for 10 hours, it would just take a while to create that many triggers, lol.

This way seems pretty efficient so I don't think you can make it much simpler.

Actually you could simplify it by using a Simple Condition action instead of IF-THEN-ENDIF.

1 Like

As you have the rule written now it appears that it will trigger every 15 minutes throughout the day but only execute actions, what ever actions you add to it, between sunset and sunrise.

If you are looking to not have it trigger during the day and only trigger every 15 minutes at night I would try writing an additional rule, I'll call it the parent rule, your current rule being the child, that runs once at sunset and once at sunrise. At sunrise have the parent rule pause your child rule, and at sunset have the parent rule un-pause the child rule.

I'm not at home where I can test that but when I saw your post this came to mind so I thought I'd share it.

This wouldn't stop the rule from being triggered, and is essentially equivalent to what he's done.

1 Like

Thanks! Wasn't sure. Was going to test it when I got home from work. But, appears no need to.