Azure IoT hub examples

This flow has several examples to help you get started sending data from Node-Red to Microsoft Azure IoT Hubs. More info can be found at http://electronhacks.com

[{"id":"191eb7ca.b71a8","type":"azureiothub","z":"2ac65269.04174e","name":"Azure IoT Hub","protocol":"mqtt","x":458,"y":349,"wires":[["39c7854c.56d18a"]]},{"id":"aa561f4a.a44358","type":"function","z":"2ac65269.04174e","name":"Function","func":"msg1 = '{\"deviceID\": \"Arduino001\", '\nmsg1 = msg1 + '\"SAK\": \"Yub6LJ9vjuPaJ4zWXCPEYr8+eRByyCUwB3h8VefIlEE=\", '  \nmsg1 = msg1 + '\"Protocol\": \"mqtt\", '\nmsg1 = msg1 + '\"Data\": { \"' + msg.topic + '\": \"' + msg.payload + '\"}}'\n\nnewMsg = { payload: msg1 };\nreturn newMsg;\n","outputs":1,"noerr":0,"x":322,"y":511,"wires":[["191eb7ca.b71a8","39c7854c.56d18a"]]},{"id":"48115883.03fae8","type":"inject","z":"2ac65269.04174e","name":"Speed","topic":"speed","payload":"345","payloadType":"num","repeat":"","crontab":"","once":false,"x":139,"y":476,"wires":[["aa561f4a.a44358"]]},{"id":"39c7854c.56d18a","type":"debug","z":"2ac65269.04174e","name":"","active":true,"console":"false","complete":"payload","x":626.3400268554688,"y":439.47998046875,"wires":[]},{"id":"31ae88af.f84fa","type":"inject","z":"2ac65269.04174e","name":"Temperature","topic":"temperature","payload":"87","payloadType":"num","repeat":"","crontab":"","once":false,"x":157,"y":512,"wires":[["aa561f4a.a44358"]]},{"id":"fc5e350.8f97e48","type":"inject","z":"2ac65269.04174e","name":"Pressure","topic":"pressure","payload":"2342","payloadType":"num","repeat":"","crontab":"","once":false,"x":147,"y":548,"wires":[["aa561f4a.a44358"]]},{"id":"f3fce0b1.76ed6","type":"inject","z":"2ac65269.04174e","name":"Send Multiple Values","topic":"","payload":"{\"deviceID\": \"Arduino001\", \"SAK\": \"Yub6LJ9vjuPaJ4zWXCPEYr8+eRByyCUwB3h8VefIlEE=\", \"Protocol\": \"mqtt\", \"Data\": { \"AvgFlowRate\" : 500, \"FlowRate\" : 700, \"AvgStaticPressure\" : 525, \"StaticPressure\" : 518, \"AvgCasingPressure\" : 776, \"CasingPressure\" : 805, \"AvgTubingPressure\" : 609, \"TubingPressure\" : 588}}","payloadType":"json","repeat":"","crontab":"","once":false,"x":178,"y":337,"wires":[["191eb7ca.b71a8"]]},{"id":"15aa66ba.d05be9","type":"inject","z":"2ac65269.04174e","name":"Send one value","topic":"","payload":"{\"deviceID\": \"Arduino001\", \"SAK\": \"Yub6LJ9vjuPaJ4zWXCPEYr8+eRByyCUwB3h8VefIlEE=\", \"Protocol\": \"mqtt\", \"Data\": { \"Speed\" : \"25\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"x":155.90994262695312,"y":299.0900192260742,"wires":[["191eb7ca.b71a8"]]},{"id":"24956e6.952af12","type":"inject","z":"2ac65269.04174e","name":"Send one value","topic":"","payload":"{\"deviceID\": \"Device1\", \"SAK\": \"AuCI9KBBg0WY9+KbEZLiDsN/cn8JTf6se5BJYcJhCws=\", \"Protocol\": \"mqtt\", \"Data\": { \"Speed\" : \"25\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"x":161,"y":231,"wires":[["191eb7ca.b71a8"]]}]
ElectronHacks

Flow Info

created 7 months, 3 weeks ago

Node Types

Core
  • debug (x1)
  • function (x1)
  • inject (x6)
Other
  • azureiothub (x1)

Tags

  • Node-red
  • IoT
  • Azure
  • Microsoft
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option