Skip to content

Instantly share code, notes, and snippets.

@rashidakamal
Created April 2, 2019 01:29
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 rashidakamal/5d830a73e96a584e857831d93c6bc685 to your computer and use it in GitHub Desktop.
Save rashidakamal/5d830a73e96a584e857831d93c6bc685 to your computer and use it in GitHub Desktop.
[{"id":"5c2de65e.d3eff8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"950800cd.8121c","type":"mqtt in","z":"5c2de65e.d3eff8","name":"","topic":"itp/+/humidity","qos":"0","datatype":"auto","broker":"b6d08c13.d9e6c","x":90,"y":120,"wires":[["d17e9a48.c7bd28"]]},{"id":"58acfbd6.ac1074","type":"debug","z":"5c2de65e.d3eff8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":280,"wires":[]},{"id":"d17e9a48.c7bd28","type":"function","z":"5c2de65e.d3eff8","name":"humidity_alert","func":"const humidity = Number(msg.payload);\nif (humidity > 25) {\n const alertMessage = `Humidity is currently ${humidity}, which may be mininally comfortable for most humans.`\n\n // get the device id and create a new topic\n const device = msg.topic.split('/')[1];\n msg.topic = `itp/${device}/alert`;\n msg.payload = alertMessage;\n return msg;\n} else {\n return null;\n}\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":180,"wires":[["376491ca.ae2f9e","58acfbd6.ac1074"]]},{"id":"376491ca.ae2f9e","type":"e-mail","z":"5c2de65e.d3eff8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"rashida.kamal@nyu.edu","dname":"send nyu rashida","x":550,"y":120,"wires":[]},{"id":"b6d08c13.d9e6c","type":"mqtt-broker","z":"","name":"iotwork.shop","broker":"iotwork.shop","port":"8883","tls":"","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment