Skip to content

Instantly share code, notes, and snippets.

@ChrSchultz
Created December 15, 2017 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrSchultz/a5f6996c0428079e784aaf0c5f2f2efa to your computer and use it in GitHub Desktop.
Save ChrSchultz/a5f6996c0428079e784aaf0c5f2f2efa to your computer and use it in GitHub Desktop.
node-red-Openweathermap-frost-warn-via-mail-and-twitter

this node sends A warning if the temperature is beyound or above a setted value as double. setting up:

  • you need an API-Key from Openweathermap.org register and aquire an Key for free.
  • edit the openweahtermap-node, insert your API-key and City and Country-Iso-code eg. London and UK
  • edit the function-node the condition term values and the comparision statement
  • edit the Twitter-node
  • and the email-node for notifying.

than you can click on the button of the injection-input node and see the result in your email or on debug-window. and/or on your twitter-account.

[{"id":"77de7965.5acf58","type":"inject","z":"95e961b4.a68258","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":202,"y":72,"wires":[["b4081dd5.2586"]]},{"id":"b4081dd5.2586","type":"openweathermap","z":"95e961b4.a68258","name":"Weather ","wtype":"forecast","lon":"","lat":"","city":"","country":"","language":"de","x":488,"y":110,"wires":[["9509f59.6cbbf88","21b4a54f.ebd7fa"]]},{"id":"45d650c6.75116","type":"inject","z":"95e961b4.a68258","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"00 12 * * *","once":false,"x":204,"y":127,"wires":[["b4081dd5.2586"]]},{"id":"9509f59.6cbbf88","type":"debug","z":"95e961b4.a68258","name":"","active":true,"console":"false","complete":"payload","x":787,"y":131,"wires":[]},{"id":"21b4a54f.ebd7fa","type":"function","z":"95e961b4.a68258","name":"createWarning","func":"for (i=0;i<msg.payload.length;i++){\n if (msg.payload[i].main.temp_min < 3.0){\n var msg1 ={payload: \"Achtung! am \" +msg.payload[i].dt_txt + \"\\nTemperatur min. :\" + msg.payload[i].main.temp_min};\n break;\n }\n } \nreturn msg1;","outputs":1,"noerr":0,"x":644,"y":233,"wires":[["b2776f3d.bb4ea8","8dfbdd2f.592b","b617eb9a.1cb81"]]},{"id":"b2776f3d.bb4ea8","type":"e-mail","z":"95e961b4.a68258","server":"smtp.google.com","port":"465","secure":true,"name":"Mail","dname":"","x":915,"y":295,"wires":[]},{"id":"8dfbdd2f.592b","type":"twitter out","z":"95e961b4.a68258","twitter":"","name":"Twitter","x":818,"y":366,"wires":[]},{"id":"b617eb9a.1cb81","type":"debug","z":"95e961b4.a68258","name":"","active":true,"console":"false","complete":"payload","x":842,"y":231,"wires":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment