Skip to content

Instantly share code, notes, and snippets.

@arpitbajpai
Created January 10, 2017 22:41
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 arpitbajpai/583366a24ce891b55e16cc140759e24e to your computer and use it in GitHub Desktop.
Save arpitbajpai/583366a24ce891b55e16cc140759e24e to your computer and use it in GitHub Desktop.
Poll the Air

Pollution Sensor MQ 135 and GPS module working together. The data is posted to the backend Service using HTTP request node.

[{"id":"35dc59de.d3f096","type":"function","z":"30b66680.bf1e7a","name":"","func":"msg.headers = {'content-type':'application/json',\n 'method':'POST'};\nmsg.payload = {\n \"Latitude\" : msg.payload.lat,\n \"Longitude\" : msg.payload.lon,\n \"Pollution\" : \"\"+global.get(\"count\")+\"\"\n \n \n }\n\nreturn msg;","outputs":1,"noerr":0,"x":207.5,"y":318,"wires":[["28e1e63.5bc211a"]]},{"id":"6d31e90c.a22cf8","type":"http request","z":"30b66680.bf1e7a","name":"","method":"POST","ret":"txt","url":"https://poll0s0016680479trial.hanatrial.ondemand.com/PollTheAir/OData.svc/Pollutiondatas","tls":"","x":616.5,"y":165,"wires":[[]]},{"id":"60bdad47.9b1754","type":"inject","z":"30b66680.bf1e7a","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"x":130.5,"y":73,"wires":[["13ad87f8.448938"]]},{"id":"57dc4df2.d1d494","type":"gpsd","z":"30b66680.bf1e7a","name":"","hostname":"localhost","port":"2947","tpv":true,"sky":true,"info":true,"device":true,"gst":true,"att":true,"x":110,"y":165,"wires":[["35dc59de.d3f096"]]},{"id":"13ad87f8.448938","type":"pimcp3008","z":"30b66680.bf1e7a","name":"","pin":0,"dnum":0,"x":295.5,"y":73,"wires":[["6bfd8d8c.a975c4"]]},{"id":"28e1e63.5bc211a","type":"delay","z":"30b66680.bf1e7a","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":349,"y":199,"wires":[["e054efb8.43ed8"]]},{"id":"6bfd8d8c.a975c4","type":"function","z":"30b66680.bf1e7a","name":"","func":"global.set('count',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":450.5,"y":104,"wires":[[]]},{"id":"e054efb8.43ed8","type":"switch","z":"30b66680.bf1e7a","name":"","property":"payload.Latitude","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","outputs":1,"x":407.5,"y":324,"wires":[["ea9cb567.901f38"]]},{"id":"ea9cb567.901f38","type":"debug","z":"30b66680.bf1e7a","name":"","active":true,"console":"false","complete":"payload","x":610.5,"y":354,"wires":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment