Condition based on time of day

Basically, I want my outside lights to be on when I come home from work. Now that summer is coming the sun is still up when I get home so there’s really no need. I have a schedule for turning the lights on at sunset called weekday_sunset. How could I make a condition that would only happen before a static time, like 6pm. I thought it would be like “weekday_sunset AND NOW < 18:00:00” but that didn’t work.

Try this:

weekday_sunset AND (weekday_sunset < 18:00:00)

@Qwen 3579
Your solution turns the lights on at Sunset, not at arrival time.

If you create a PLEG input schedule, call it Night as
On Mon-Sun at Sunset + 15 minutes off at Mon-Sun at 15 minutes before Sunrise.

Another schedule call ReturnHome
On Mon-Friday at 18:00 off 15 Minutes later.

Then have conditions:

ArrivalLights Night and ReturnHome
ArrivalOff Not ArrivalLights

Add actions to turn on/off the lights to the above conditions.

[quote=“RichardTSchaefer, post:3, topic:181059”]@Qwen 3579
Your solution turns the lights on at Sunset, not at arrival time.[/quote]

My mistake! That’s why you’re the man! ;D

The multiple schedules seems like a winner so I’ll go with that, thanks :slight_smile:

Just out of curiosity, the other one doesn’t work:

Program Logic Event Generator[16] : weekday_sunset AND (weekday_sunset < 18:00:00): Invalid Value token: 18:00:00

Does that mean that schedules are the only way to do time based conditions? Or is there some way to get the syntax right?

He had a syntax error:
It should have been:
weekday_sunset AND (weekday_sunset;18:00:00):

What this will do is to turn on the light at Sunset as ling as sunset is before 6 PM.

Ouch! 0 for 2!

As you can tell, I sometimes have a bit of trial and error with my PLEG statements.

EDIT: Actually, I think that statement will do what he is wanting to do. He wants the lights to come on at night as long as that occurs before 6 PM.