Turn the lights on at sundown or 7pm, whichever is earlier

I assume this will be an easy one, but I’m a total node-red noob: for my vacation mode, I want the lights to come on at sundown or at 7pm, whichever is earlier. That way, in the summer months, the house doesn’t stay dark until ~9pm when the sun finally goes down. Any advice?

Right now I’m using bigtimer and have it triggering off just sundown. Maybe I can combine this with another bigtimer and use OR logic to achieve what I want? Should I just have 2 bigtimers that feed into the same sequence? I’ll have the “repeat every 1 minute” option enabled, so I was worried about 2 timers causing the lights to turn on and off repeatedly, if one ever wants them on while the other wants them off.

I’d also like to know how I can combine two timers with AND, so that e.g. I can have the lights turn on if it’s 7pm and after sundown.

On the surface, why don’t you have two timers feeding into your light node?
Obviously the earlier one will turn on the lights first!

If you are concerned with the second node turning on the lights after you’ve explicitly turned off the lights then you can simply place a rate limiting before the light node to drop any messages after the first one.

Part of the appeal of bigtimer for me is the option to trigger ON once per minute if the current time is within the range, and OFF if isn’t. That way, the lights enter the state they should be in within a minute of switching the house to vacation mode. My concern is that with one timer starting at sundown and the other at 7pm, then for a couple of hours each day they’ll be sending competing messages.

If one is sending “ON” and the other is sending “OFF” then you have a logical error trying to accomplish your flow.

Which one is the real truth?
Both values are logical, but only one should be accepted.

You need to determine which you want to be correct in that case.

Yeah, that’s why my initial question was basically: how can I combine these two timers using OR logic? If either says on, then I want the lights to turn on. I suppose I could listen to all the once-per-minute messages and turn the lights off only when there are two off messages in a row. But I’m not sure how to go about that, and it seems like there should be an easier/less hacky way.

this is how i have done it. maybe you can manipulate the time range node.

or best bet would be to use 3 big timer nodes.

  1. switch lights on at sunset
  2. switch lights at 7pm
  3. switch lights off.

the first 2 timers you can setup to say only turn on if you are home. i user person entity from life360.

im very new to this as well and thats the best i can come up with :slight_smile:

Just to chime in, there is an easier way to do this with Time of day sensors in HA: https://www.home-assistant.io/integrations/tod/

They create binary sensors in HA that you can use as event triggers in NodeRed and makes it much simpler (imho) to do time based events in NodeRed.