# Need help with between time logic

Hi,

I'm trying to limit when these lights come on. During the winter when the sunrise is after 7am it works fine, but now that it is earlier, it seems to be looking forward the 24 hours as it is evaluating true. Does anyone know how to fix this clause?

Thank you in advance!

You should check out Room Lights instead of RM. Much easier for things like this, and it has Earlier/Later of two times feature.

1 Like

It's looking forward because sunrise is before 7 am. So, at 7 am, the next sunrise is 6:49 am the following day.

1 Like

To make this work in RM you need two over lapping time conditions. Pick a time that will always be before Sunrise+30. Let's say 4:00 AM for this example. Make your first condition
`Time between 4:00 AM and Sunrise+30 minutes`

Now pick a time that will always be after Sunrise+30. Let's say 9:00 AM. Make your second condition
`Time between 7:00 AM and 9:00 AM`

Make your IF
`IF (Time between 4:00 AM and Sunrise+30 minutes AND Time between 7:00 AM and 9:00 AM) THEN`

Since both conditions must be true, this will only work when Sunrise+30 is after 7:00 AM.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.