moon position - rdmtc/node-red-contrib-sun-position GitHub Wiki
The node calculates the current sun position on any input message.

[{"id":"d99ac08d.fdb94","type":"moon-position","z":"de4e9c38.0d942","name":"","positionConfig":"2831ba70.55a636","rules":[],"outputs":1,"topic":"","x":340,"y":520,"wires":["e5e8e9a1.6080e8","e9ec273d.d90168","45563d84.0c4bf4","cce94ccc.b2dd2","65c76f28.3dd49","ac44c210.86465","f2deae49.60015","a9e0a2d1.0633a","948f6e2.8a4a39","cc85e458.447ba8","bff5a621.3fb498"](/rdmtc/node-red-contrib-sun-position/wiki/"e5e8e9a1.6080e8","e9ec273d.d90168","45563d84.0c4bf4","cce94ccc.b2dd2","65c76f28.3dd49","ac44c210.86465","f2deae49.60015","a9e0a2d1.0633a","948f6e2.8a4a39","cc85e458.447ba8","bff5a621.3fb498")},{"id":"124bfd72.dcb2f3","type":"inject","z":"de4e9c38.0d942","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":520,"wires":["d99ac08d.fdb94"](/rdmtc/node-red-contrib-sun-position/wiki/"d99ac08d.fdb94")},{"id":"e5e8e9a1.6080e8","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":520,"wires":[]},{"id":"e9ec273d.d90168","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":580,"y":560,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"45563d84.0c4bf4","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":580,"y":600,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"cce94ccc.b2dd2","type":"change","z":"de4e9c38.0d942","name":"distance","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.distance","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":640,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"65c76f28.3dd49","type":"change","z":"de4e9c38.0d942","name":"parallacticAngle","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.parallacticAngle","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":680,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"ac44c210.86465","type":"change","z":"de4e9c38.0d942","name":"illumination angle","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.angle","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":720,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"f2deae49.60015","type":"change","z":"de4e9c38.0d942","name":"illumination fraction","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.fraction","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":760,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"a9e0a2d1.0633a","type":"change","z":"de4e9c38.0d942","name":"illumination phase","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.phase.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":800,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"948f6e2.8a4a39","type":"change","z":"de4e9c38.0d942","name":"illumination phase angle","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.phase.angle","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":840,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"bff5a621.3fb498","type":"change","z":"de4e9c38.0d942","name":"illumination zenithAngle","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.zenithAngle","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":920,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"cc85e458.447ba8","type":"change","z":"de4e9c38.0d942","name":"illumination phase name","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.illumination.phase.name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":880,"wires":[](/rdmtc/node-red-contrib-sun-position/wiki/)},{"id":"2831ba70.55a636","type":"position-config","z":"","name":"Kap-Halbinsel","longitude":"-34.357051","latitude":"18.473782","angleType":"deg"}]
moon-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
moon-position - Node Input
The Input is for triggering the calculation.
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.
moon-position - Node Output
- first output
msg.payload.azimuththe azimuth of the moon position relative to the given coordinates.msg.payload.altitudethe altitude/elevation of the moon position relative to the given coordinates.msg.payload.distancethe distance of the moon.msg.payload.parallacticAnglethe parallacticAngle of the moon.msg.payload.illuminationthe illumination of the moon as object.msg.payload.illumination.anglethe illumination angle of the moon.msg.payload.illumination.fractionthe illumination fraction angle of the moon.msg.payload.illumination.zenithAnglethe illumination zenith angle of the moon.msg.payload.illumination.phasethe illumination phase of the moon as object.msg.payload.illumination.phase.valuethe current phase of the moon in percent, where 0%/100% is New Moon, from 0% to 50% is growing, 50% is Full Moon and >50% is decreasing.msg.payload.illumination.phase.anglethe current phase angle of the moon.msg.payload.illumination.phase.emojithe emoji of the current phase of the moon.msg.payload.illumination.phase.codethe code of the emoji for the current phase of the moon.msg.payload.illumination.phase.namethe name of the current phase of the moon.
msg.payload.timesthe moon times as object.msg.payload.times.risethe moon rise time.msg.payload.times.setthe moon set time.msg.payload.times.alwaysUpboolean which is true if the moon never rises/sets and is always above the horizon during the day.msg.payload.times.alwaysDownboolean which is true if the moon is always below the horizon.
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.
{
"lastUpdate": "2018-11-11T11:11:11.111Z",
"latitude": "18.473782",
"longitude": "-34.357051",
"angleType": "deg",
"azimuth": 108.71205459404247,
"altitude": -9.578482237780767,
"distance": 400811.8001636167,
"parallacticAngle": -73.92702172116152,
"illumination": {
"angle": -94.27663428960696,
"fraction": 0.14981886026806135,
"phase": {
"emoji": "🌒",
"code": ":waxing_crescent_moon:",
"name": "Waxing Crescent",
"weight": 6.3825,
"value": 0.12651089732280724,
"angle": 45.54392303621061
},
"zenithAngle": -20.349612568445437
},
"times": {
"rise": "2018-11-11T11:44:22.877Z",
"set": "2018-11-11T23:10:07.389Z",
"alwaysUp": false,
"alwaysDown": false
},
"pos": [],
"posChanged": false
}
- second output to ... output if limits for azimuth are defined the incoming message will send to this output. It adds a
msg.payload.posChangedproperty of type boolean which is true if the limit has changed since the last azimuth calculation.