Aurora visibility

An idea shamelessly borrowed from to go and get the Geomagnetic Activity (KP Index) from NOAA and parse it and produce wo outputs.

First is the actual current KP value and the second is a crudely calculated true false output that would indicate if you have any chance of seeing the aurora at the latitude hard coded in the function. (and yes it only handles northern hemisphere :-)

For more info on the Kp index - see

(Sadly it has nothing to do with Kevin Pietersen's batting performance - though given the random nature of the index... maybe it does...)

[{"id":"457c4f87.2929b8","type":"inject","name":"","topic":"","payload":"","repeat":"","crontab":"*/30 * * * *","once":false,"x":134.16666889190674,"y":103.16669178009033,"z":"9e3ede37.ad0aa","wires":[["c61a00d1.df899"]]},{"id":"c61a00d1.df899","type":"http request","name":"","method":"GET","url":"","x":259.1666603088379,"y":159.16669178009033,"z":"9e3ede37.ad0aa","wires":[["95cf58eb.ad865"]]},{"id":"2741b193.92e1ce","type":"debug","name":"","active":true,"complete":"false","x":645.1667060852051,"y":104.1666841506958,"z":"9e3ede37.ad0aa","wires":[]},{"id":"95cf58eb.ad865","type":"function","name":"parse NOAA kp log","func":"var lat = 51.05;\n\n// first output is the current kp value\n// second is whether it is likely to be visible from your latitude\n// ( on a clear night etc etc )\n\nvar lines = msg.payload.split(\"\\n\");\nvar last = lines[lines.length - 2];\nlast = last.replace(/\\s{2,}/g, ' ');\nvar bits = last.split(\" \");\nvar status = Number(bits[4]);\nvar kp = Number(bits[bits.length - 1]);\n\nvar visible = false;\nvar edge = 3;\nif (lat >= 60) edge = 3;\nelse edge = (60-lat)/2 + 3;\n\nif (kp > edge) visible = true;\nif (lat < 45) visible = false;\n\nmsg = { payload:kp };\nmsg2 = { payload:visible };\n\nif (status <= 1) return [msg,msg2];\nreturn null;","outputs":"2","x":419.1666793823242,"y":103.1666841506958,"z":"9e3ede37.ad0aa","wires":[["2741b193.92e1ce"],["8b774bee.d4c848"]]},{"id":"1e6719b0.ce9ba6","type":"comment","name":"Idea shamelessly copied from","info":"","x":406.1666564941406,"y":61.166669845581055,"z":"9e3ede37.ad0aa","wires":[]},{"id":"8b774bee.d4c848","type":"debug","name":"","active":true,"complete":"false","x":647.1667060852051,"y":148.1666774749756,"z":"9e3ede37.ad0aa","wires":[]}]

Flow Info

created 4 years, 8 months ago

Node Types

  • comment (x1)
  • debug (x2)
  • function (x1)
  • http request (x1)
  • inject (x1)


  • Kp
  • aurora
  • noaa
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option