Node Red HE Sunset event minus X minutes

Hello, does anyone know how to use the Location node in NR when starting a flow X minutes before a sunset event?

Do you mean the Hubitat NR integration Location node, or a geolocation node?

If it is former, then set a variable to the value of the Location node; the variable will change as the Location event changes. Check the variable's value (or a list of acceptable values) using a switch node in your sequence that begins X minutes before sunset.

2 Likes

I use a node-red-contrib-bigtimer or node-red-contrib-time-range-switch to make things happen relative to Sunrise/Sunset instead. Bigtimer has a ton of options.

3 Likes

Since @aaiyar gave a good answer i'll give an alturnative I think I got from him ;).

I use the "big timer" node for this sunset -15 minute lighting sequence. Inside the node you set your lat/long and it takes it from there.

Sunset Lighting example
[{"id":"a049cae0.185908","type":"group","z":"3774a69e.816a3a","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["3307f9bc.3027f6","810212ff.f859b","3bfc1f08.b8352","aafaad3.9f41a5","e11527a0.ac0088","c64bd7.f8a03428","25880b89.90a614","ce0dcbd6.b92478","58e1edc5.6242e4","7119d0bb.226b2","2ab46407.6de6cc","98dc10b5.f1192"],"x":74,"y":923,"w":932,"h":355},{"id":"3307f9bc.3027f6","type":"link out","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Start Rainbow In","links":["66a1abeb.0f8c44"],"x":764,"y":964,"wires":[]},{"id":"810212ff.f859b","type":"comment","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Landscape lighting Sunset -15 - Midnight","info":"","x":260,"y":1000,"wires":[]},{"id":"3bfc1f08.b8352","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Tree Lights On","server":"e56053d2.c7d11","deviceId":"840","command":"on","commandArgs":"","x":860,"y":1040,"wires":[[]]},{"id":"aafaad3.9f41a5","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"House Wash Lights On","server":"e56053d2.c7d11","deviceId":"845","command":"on","commandArgs":"","x":880,"y":1080,"wires":[[]]},{"id":"e11527a0.ac0088","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Flag Lights On","server":"e56053d2.c7d11","deviceId":"841","command":"on","commandArgs":"","x":860,"y":1000,"wires":[[]]},{"id":"c64bd7.f8a03428","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Tree Lights Off","server":"e56053d2.c7d11","deviceId":"840","command":"off","commandArgs":"","x":860,"y":1160,"wires":[[]]},{"id":"25880b89.90a614","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"House Wash Lights Off","server":"e56053d2.c7d11","deviceId":"845","command":"off","commandArgs":"","x":880,"y":1200,"wires":[[]]},{"id":"ce0dcbd6.b92478","type":"hubitat command","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Flag Lights Off","server":"e56053d2.c7d11","deviceId":"841","command":"off","commandArgs":"","x":860,"y":1120,"wires":[[]]},{"id":"58e1edc5.6242e4","type":"bigtimer","z":"3774a69e.816a3a","g":"a049cae0.185908","outtopic":"","outpayload1":"","outpayload2":"","name":"Sunset -15 - Midnight","comment":"","lat":"38.8977","lon":"-77.0365","starttime":"5004","endtime":"0","starttime2":"0","endtime2":"0","startoff":"-15","endoff":"0","startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","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,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":280,"y":1100,"wires":[[],["2ab46407.6de6cc"],[]]},{"id":"7119d0bb.226b2","type":"switch","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"on(1) or off(0)","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":580,"y":1100,"wires":[["e11527a0.ac0088","3bfc1f08.b8352","aafaad3.9f41a5","3307f9bc.3027f6"],["ce0dcbd6.b92478","c64bd7.f8a03428","25880b89.90a614","98dc10b5.f1192"]]},{"id":"2ab46407.6de6cc","type":"rbe","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":435,"y":1100,"wires":[["7119d0bb.226b2"]],"l":false},{"id":"98dc10b5.f1192","type":"link out","z":"3774a69e.816a3a","g":"a049cae0.185908","name":"Rainbow Off In","links":["85efa130.ea59d"],"x":765,"y":1237,"wires":[]},{"id":"e56053d2.c7d11","type":"hubitat config","z":"","name":"Devices Hub","usetls":false,"host":"10.13.9.11","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook__","autoRefresh":true,"useWebsocket":false}]

dang @stephen_nutt beat me to it, but I already have everything typed out so there ya go :wink:

3 Likes

@stephen_nutt @TechMedX

I guess I'm confused because from the description I thought @jpoeppelman1 already had a mechanism (eg. Bigtimer) to start a sequence X mins before sunset, but wanted to test for a specific value in the Hubitat Location node at that time.

2 Likes

ok, then we need clarification. I thought he wanted to trigger a sequence when the Location Node spit out sunrise or sunset. :grinning:

Edit: I don't even know IF the Location Node spits out anything at sunrise or sunset.

1 Like

It should - going to find out today.

ok yeah I had to read the post slowly a couple times, but if that is the case then @aaiyar nailed it just a switch/function node and a variable or two. Since you can't link a Location node directly into a sequence it would have to be done by a variable of sorts.

Dropped a debug on the location node to see what all it spits out over 24 hours.

1 Like

Ha - we think alike. Just did the same thing!

1 Like

TechMedX is a big timer! Thank you!

2 Likes

Yeah - I'm just an old timer :rofl:

1 Like

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