sun position - rdmtc/node-red-contrib-sun-position GitHub Wiki
The node calculates the current sun position on any input message. This node is compatible to node-red-contrib-blindcontroller.

[{"id":"fc962ea1.197a3","type":"inject","z":"de4e9c38.0d942","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":300,"wires":["56265aeb.99f034"](/rdmtc/node-red-contrib-sun-position/wiki/"56265aeb.99f034")},{"id":"a0d0e562.7ad1d8","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":570,"y":300,"wires":[]},{"id":"56265aeb.99f034","type":"sun-position","z":"de4e9c38.0d942","name":"","positionConfig":"2831ba70.55a636","rules":[{"valueLow":"10","valueLowType":"num","valueHigh":"100","valueHighType":"num"}],"onlyOnChange":"true","topic":"","outputs":2,"x":330,"y":300,"wires":["a0d0e562.7ad1d8","9cc2d51.4ac0828","28e91.9d63d16f6"],["e921e01a.a0fa3"](/rdmtc/node-red-contrib-sun-position/wiki/"a0d0e562.7ad1d8","9cc2d51.4ac0828","28e91.9d63d16f6"],["e921e01a.a0fa3")},{"id":"9cc2d51.4ac0828","type":"change","z":"de4e9c38.0d942","name":"azimuth","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.azimuth","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":340,"wires":["e866e950.a7f798"](/rdmtc/node-red-contrib-sun-position/wiki/"e866e950.a7f798")},{"id":"28e91.9d63d16f6","type":"change","z":"de4e9c38.0d942","name":"altitude","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.altitude","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":380,"wires":["5b085e1b.4ec8a"](/rdmtc/node-red-contrib-sun-position/wiki/"5b085e1b.4ec8a")},{"id":"e921e01a.a0fa3","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":550,"y":420,"wires":[]},{"id":"e866e950.a7f798","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":750,"y":340,"wires":[]},{"id":"5b085e1b.4ec8a","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":750,"y":380,"wires":[]},{"id":"2831ba70.55a636","type":"position-config","z":"","name":"Kap-Halbinsel","longitude":"-34.357051","latitude":"18.473782","angleType":"deg"}]
sun-position - Node settings

- Position connects to the central configuration node, which contains the current position, but also handles internal shared functions
- Topic defines the topic of the first output
- position container here you can define multiple lower and upper limits for azimuth. If the calculated value of the azimuth is inside the defined limit the input message will send to the associated output.
- Name name of the Node
sun-position - Node Input
The Input is for triggering the calculation. If limits are defined the input message will send to the output associated to the limit.
It is possible that the incoming message have properties msg.latitude and msg.longitude (or msg.lat and msg.lon) defined to override settings in configuration node. The configuration node still needs to be configured properly.
sun-position - Node Output
-
first output
msg.payload.azimuththe azimuth of the sun position relative to the given coordinates.msg.payload.altitudethe altitude/elevation of the sun position relative to the given coordinates.msg.payload.timesthe sun times as object.msg.payload.times.astronomicalDawnnight ends (morning astronomical twilight starts)msg.payload.times.amateurDawnamateur astronomical dawn (sun at 12° before sunrise)msg.payload.times.nauticalDawnnautical dawn (morning nautical twilight starts)msg.payload.times.blueHourDawnStartblue Hour start (time for special photography photos starts)msg.payload.times.civilDawndawn (morning nautical twilight ends, morning civil twilight starts)msg.payload.times.blueHourDawnEndblue Hour end (time for special photography photos starts)msg.payload.times.sunrisesunrise (top edge of the sun appears on the horizon)msg.payload.times.sunriseEndsunrise ends (bottom edge of the sun touches the horizon)msg.payload.times.goldenHourDawnEndmorning golden hour (soft light, best time for photography) endsmsg.payload.times.solarNoonsolar noon (sun is in the highest position)msg.payload.times.goldenHourDuskStartevening golden hour startsmsg.payload.times.sunsetStartsunset starts (bottom edge of the sun touches the horizon)msg.payload.times.sunsetsunset (sun disappears below the horizon, evening civil twilight starts)msg.payload.times.blueHourDuskStartnautical dusk start (evening astronomical twilight starts)msg.payload.times.civilDuskdusk (evening nautical twilight starts)msg.payload.times.blueHourDuskEndnautical dusk end (evening astronomical twilight starts)msg.payload.times.amateurDuskamateur astronomical dusk (sun at 12° after sunrise)msg.payload.times.astronomicalDusknight starts (dark enough for astronomical observations)msg.payload.times.nadirnadir (darkest moment of the night, sun is in the lowest position)
msg.payload.posarray with a boolean of every defined limit of the azimuth, which is true if the azimuth is inside the limit.msg.payload.posChangedboolean which is true if any of the defined limit of the azimuth has changed to the last calculation.msg.payload.startTimeif a start time is defined the start timestamp (inclusive of offset).msg.payload.endTimeif a end time is defined the end timestamp (inclusive of offset).msg.payload.sunInSkyif a start and an end time is defined a boolean value indicating whether it is currently considered daylight hours.msg.payload.altitudePercentgives the altitude in percent between horizon (0%) and solar noon (100%) (will not calculated if sun position for a time is calculated which is not today or tomorrow).
-
second output to ... output if limits for azimuth are defined the incoming message will send to this output. It adds a
msg.posChangedproperty of type boolean which is true if in the previous calculation no message was send to this output.