Day or Night time rule

As far as i know Hubitat knows sunset and sunrise, ergo knows when is day and night. Id like to setup a rule for a motion sensor light only work at night time. Not based on luminance, Based on time of day.

Thank you

You could use a Conditional Action, if time is between sunset and sunrise...
Add AND conditions if your time block is different from the normal sunset and sunrise times.

If time is between 18:00 and 23:00 AND if time is between sunset and sunrise

No need to even have a "rule". Use Motion Lighting, and restrictions. It will be 100 times simpler than writing a rule, especially for people who aren't as familiar with Rule Machine.

1 Like

That's correct.

Maybe I misunderstood the question. I understood that OP wants the motion to trigger during a specific time period, but only if it's dark. For example at 18:00 in winter, but not at 18:00 when it's summer (and the sun is still up).

The other option, which works well if you are trying to use certain times with many apps, is to use modes.

Modes are a global setting, so you can have a mode that goes from sunrise to sunset for example. (Day Mode). And another that is from Sunset to Midnight (Night mode). You could then use night mode in many or multiple places throughout Hubitat without having to select this combination of times every single time. There are more advantages to modes, but it just makes things quicker, easier, and more consistent.

In this case I use "Sleep" mode to make things not work when we should be sleeping, lights turn on very dim for motion events, mute music or noise makers, and many other actions.

??

Wouldn't sunset to sunrise or some offset ± from sunset cover this?

No. I want my porch light to turn on at 17:00 and off at 23:00 but only when it's dark.
Where I live, the sun sets at 16:30 in winter. In summer the sun sets at 22:00.
I cannot do that by sunset offset. But as I've said, maybe I didn't understand the question correctly...

That is luminance. The original person's question said NOT based on luminance.

If you have a lux sensor you can do exactly what you want.

1 Like

Exactly. Not based on luminance, but "a rule for a motion sensor light only work at night time"

Define night time. Not being argumentative, but there are multiple ways we could define it.

You want to call anything past 17:00 night time. Which you are free to do. To me, that is a silly way to define it. Others would say sunset, or pick a different specific time, or whatever. But generically speaking sunset = dark.

That is why I gave multiple options to the OP, they can pick what works right for them and their situation.

And maybe I am confused about this, but isn't the definition of sunset of when the sun goes past the horizon? So wouldn't it get dark at sunset? Sunset is not dependent upon what exact time of the day it is.

:man_shrugging:

OP's words. Not mine.

Yes, you did. If OP is not helped by now, he can ask for more help.

This was an example of what I understood the OP's question te be... Two blocks of time, sunset to sunrise and (in the example) 17:00 - 23:00. And I want the light to turn on when and only when the two blocks overlap. I'm sorry, I cannot make it clearer to you...

The OP wants the motion sensor to only work when it's dark, but not based on the dark, based on the time of day...

I rest my case now. If OP asks more questions, I'll try to help. Your solution is definitely simpler (if one doesn't know RM).