ESP / Arduino Mqtt to Influxdb

get all feeds/# data from mqtt and send it to influxdb

Modifiers: (Removing "feeds/") (Replacing "/" with "-")

Use grafana to plot drawings (single data or json multi data)

[{"id":"149750a4.a5b2f7","type":"mqtt in","z":"bc4c530.895bab","name":"MQTT","topic":"feeds/#","qos":"0","datatype":"utf8","broker":"2a7f8edf.8c5702","x":110,"y":120,"wires":[["4eea360c.f157d"]]},{"id":"4eea360c.f157d","type":"function","z":"bc4c530.895bab","name":"Replace & Add Topic","func":"var t=msg.topic;\nt = t.replace('/feeds/', '');\nt = t.replace('feeds/', '');\n\nwhile(t.search(\"/\")!=-1){\nt = t.replace('/', '-');\n}\nmsg.topic=t;\nmsg.measurement=t;\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":120,"wires":[["1072cb26.568635","9a0afdde.c41f88"]]},{"id":"60f00cd2.3c4a04","type":"influxdb out","z":"bc4c530.895bab","influxdb":"b494e610.9f55f8","name":"","measurement":"","precision":"","retentionPolicy":"","x":750,"y":120,"wires":[]},{"id":"74b25ac3.28b90c","type":"comment","z":"bc4c530.895bab","name":"Send Mqtt Messages using Topic: feeds/sensor/readings","info":"","x":370,"y":40,"wires":[]},{"id":"1072cb26.568635","type":"json","z":"bc4c530.895bab","name":"","property":"payload","action":"","pretty":false,"x":530,"y":120,"wires":[["60f00cd2.3c4a04"]]},{"id":"9a0afdde.c41f88","type":"debug","z":"bc4c530.895bab","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":390,"y":220,"wires":[]},{"id":"2a7f8edf.8c5702","type":"mqtt-broker","z":"","name":"mqttbroker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b494e610.9f55f8","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"sensors","name":"","usetls":false,"tls":""}]

Collection Info

Flow Info

Created 5 years, 6 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • debug (x1)
  • function (x1)
  • json (x1)
  • mqtt in (x1)
  • mqtt-broker (x1)
Other
  • influxdb (x1)
  • influxdb out (x1)

Tags

  • mqtt
  • influxdb
  • json
  • arduino
  • esp32
  • esp8266
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option