Turn on light at sunrise and turn them off at sunset

What’s the best flow?
Should be simple but I can’t make it work. My flow will not turn them on.

Sorry I am new to node red, for sure making dumb mistakes

Look for the ‘bigtimer’ node, under the advanced section in the left-hand panel.

It has built-ins for Sunrise & Sunset, and lots of other useful settings.

I’m just learning Node Red myself and as a simple first flow I built mine out like this

I turn my outside lights and living room lights on 20 mins after sunset then at sunrise I run through and check to see if they’re on. If they are turn them off.

Like @Bit-River said the Big Timer is what I’m using for this.

1 Like

Yes I am using bigtimer but is not firing up, must be something I am doing wrong

Thanks can you please paste the flow, mine is very similar but not working

Sure here it is

[{"id":"5ebf57f6.9234b8","type":"bigtimer","z":"8e67f38.c25091","outtopic":"","outpayload1":"","outpayload2":"","name":"Turn on at Sunset, Off at Sunrise","lat":"39.878421","lon":"-105.114861","starttime":"5004","endtime":"5003","startoff":"20","endoff":0,"offs":0,"outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":135,"y":27.5,"wires":[[],[],["cd78ec6b.f6aad"]]},{"id":"cd78ec6b.f6aad","type":"switch","z":"8e67f38.c25091","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":426,"y":38,"wires":[["c25925ea.39f348","20d46571.b6237a"],["2c3acac3.8c3ec6","dc93dcad.18ae6","c0cdb2e7.86e0d","73ce2870.95d708","4a423148.ccbf6"]]},{"id":"c25925ea.39f348","type":"api-call-service","z":"8e67f38.c25091","name":"Turn On Outside Lights","server":"d1e64946.492428","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.outside_lights\"}","mergecontext":"","x":679,"y":20,"wires":[[]]},{"id":"b9d10388.c0f5e","type":"api-call-service","z":"8e67f38.c25091","name":"Turn Off Outside Lights","server":"d1e64946.492428","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.outside_lights\"}","mergecontext":"","x":738,"y":127,"wires":[[]]},{"id":"20d46571.b6237a","type":"api-call-service","z":"8e67f38.c25091","name":"Turn On Living Room Lights","server":"d1e64946.492428","service_domain":"light","service":"turn_on","data":"{   \"entity_id\": \"light.living_room_lights\" , \"brightness_pct\":\"100\" }","mergecontext":"","x":689,"y":54,"wires":[[]]},{"id":"2c3acac3.8c3ec6","type":"api-current-state","z":"8e67f38.c25091","name":"East Wall Light On?","server":"d1e64946.492428","halt_if":"off","override_topic":true,"override_payload":true,"entity_id":"switch.east_wall_light_switch","x":476,"y":152,"wires":[["7877ed79.4ba964"]]},{"id":"7877ed79.4ba964","type":"api-call-service","z":"8e67f38.c25091","name":"Turn Off East Wall Light","server":"d1e64946.492428","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.east_wall_light_switch\"}","mergecontext":"","x":741,"y":159,"wires":[[]]},{"id":"dc93dcad.18ae6","type":"api-current-state","z":"8e67f38.c25091","name":"West Wall Light On?","server":"d1e64946.492428","halt_if":"off","override_topic":true,"override_payload":true,"entity_id":"switch.west_wall_light_switch","x":488,"y":186,"wires":[["f39825fd.2e1f88"]]},{"id":"f39825fd.2e1f88","type":"api-call-service","z":"8e67f38.c25091","name":"Turn Off Outside Lights","server":"d1e64946.492428","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.west_wall_light_switch\"}","mergecontext":"","x":742,"y":191,"wires":[[]]},{"id":"4a423148.ccbf6","type":"api-current-state","z":"8e67f38.c25091","name":"Chicken Run Light On?","server":"d1e64946.492428","halt_if":"off","override_topic":true,"override_payload":true,"entity_id":"light.chicken_run_light","x":498,"y":217,"wires":[["e9203330.fc098"]]},{"id":"e9203330.fc098","type":"api-call-service","z":"8e67f38.c25091","name":"Turn Off Chicken Run Light","server":"d1e64946.492428","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.chicken_run_light\"}","mergecontext":"","x":751,"y":220,"wires":[[]]},{"id":"c0cdb2e7.86e0d","type":"api-current-state","z":"8e67f38.c25091","name":"Boys Night Light On?","server":"d1e64946.492428","halt_if":"off","override_topic":true,"override_payload":true,"entity_id":"light.boys_night_light","x":490,"y":249,"wires":[["a177e00c.c944e"]]},{"id":"a177e00c.c944e","type":"api-call-service","z":"8e67f38.c25091","name":"Turn Off Boys Night Light","server":"d1e64946.492428","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.boys_night_light\"}","mergecontext":"","x":740,"y":249,"wires":[[]]},{"id":"73ce2870.95d708","type":"api-current-state","z":"8e67f38.c25091","name":"Outside Lights On?","server":"d1e64946.492428","halt_if":"off","override_topic":true,"override_payload":true,"entity_id":"light.outside_lights","x":477,"y":120,"wires":[["b9d10388.c0f5e"]]},{"id":"d1e64946.492428","type":"server","z":"","name":"Home Assistant","url":"http://localhost:8123","pass":""}]
5 Likes

Thanks i will check once on the pc

1 Like

yes it works well, I guess before I used bigtimer wrongly

1 Like

I still don t get it how it really works.

I do need a very simple command to turn off a switch at 23.59, what would be the correct way to use bigtimer?

I don’t think that big timer will let you get that precise with it. If you just need something to turn off at a specific time use an injent node and tell it to run at that time like this

2 Likes

Set “Off” to 23:45 and the offset to +14.

Thanks i used this now

1 Like

I did that, but after clicking Deploy it turned off the switch … Still i am missing the logic

Glad to hear it :slight_smile:

How are you turning it on?
Also, untick “Output at Startup”.

If this doesn’t help, go to the Node Red forums and ask there- the author of BigTimer reads that forum.

That should help

There is a great node from Pete Scargill called BigTimer … this is working great and can be used for almost any time based flow.

Additionally, there is a small sunevent which is easy to use.

A good source to find flow samples is here

I can’t get it to work.
Changed my location and the “call service” with my own entity and nothing happens.
Very frustrating…

I’m using scenes for the garden lights. I got the message under the “call service” label “no connection at …”

I know this is an old post, but I’m running into the same issue. Bigtimer is set to fire an hour before sunset but it never fires. I have my lat/long there, selected sunset and offset -60 (for -60 minutes). Any ideas why?

I use this Node and it works great injecting based on a sun event