Skip to content

Instantly share code, notes, and snippets.

@pdomineaux
Created October 14, 2016 15:26
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 pdomineaux/1d89b384a115338e8a210d49ee474cfb to your computer and use it in GitHub Desktop.
Save pdomineaux/1d89b384a115338e8a210d49ee474cfb to your computer and use it in GitHub Desktop.
BMP180 to Influxdb

This flow allow you to write measurements (temperature, pressure and altitude) of your BMP180 sensor connected on your Raspberry Pi to an influxdb database.

[{"id":"f1ad0983.5176d8","type":"json","z":"29ac22f9.6aefae","name":"Convert 2 JSON","x":310.5357131958008,"y":960.4006690979004,"wires":[["cd173549.4267e8"]]},{"id":"da92b91b.9abdb8","type":"mqtt in","z":"29ac22f9.6aefae","name":"","topic":"iot/sensors/BMP180","qos":"2","broker":"4a94fdae.3781a4","x":123.57142639160156,"y":1023.1073169708252,"wires":[["f1ad0983.5176d8"]]},{"id":"cd173549.4267e8","type":"template","z":"29ac22f9.6aefae","name":"Format to Influxdb","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"temperature\": {{payload.temperature}}, \"pressure\": {{payload.pressure}}, \"altitude\": {{payload.altitude}} }\n{{! Remove the seaLevel measurement because of null value }}","x":476.25000762939453,"y":873.4723024368286,"wires":[["e5a6d2be.b4efa"]]},{"id":"e5a6d2be.b4efa","type":"json","z":"29ac22f9.6aefae","name":"Convert 2 JSON again","x":641.3293304443359,"y":817.1626529693604,"wires":[["718b19c6.872e78"]]},{"id":"f885bbf.e6fca48","type":"influxdb out","z":"29ac22f9.6aefae","influxdb":"a2438c77.956c8","name":"","measurement":"","x":949.1626968383789,"y":646.198447227478,"wires":[]},{"id":"718b19c6.872e78","type":"function","z":"29ac22f9.6aefae","name":"Send msg.measurement","func":"\n// send msg.measurement property as required by Influxdb node\nvar tokens = msg.topic.split(\"/\");\nmsg.measurement = tokens[2];\nreturn msg;","outputs":1,"noerr":0,"x":762.8571548461914,"y":736.9245834350586,"wires":[["f885bbf.e6fca48"]]},{"id":"4a94fdae.3781a4","type":"mqtt-broker","z":"29ac22f9.6aefae","broker":"yourRaspberryPiIp","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"a2438c77.956c8","type":"influxdb","z":"29ac22f9.6aefae","hostname":"yourInfluxdbHost","port":"8086","database":"iotdb","name":""}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment