# MQTT-\>(JSON)-\>?-\>InfluxDB-\>Grafana

**URL:** <https://discourse.nodered.org/t/mqtt-json-influxdb-grafana/7108>\
**Category:** General\
**Created:** [21 January 2019 18:45 UTC](https://discourse.nodered.org/t/mqtt-json-influxdb-grafana/7108 "2019-01-21T18:45:50Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [21 January 2019 21:22 UTC](https://discourse.nodered.org/t/mqtt-json-influxdb-grafana/7108/3 "2019-01-21T21:22:42Z")

</div>

If the data is minimal, and you want to use the influx single node, this works for me -

```auto
if(msg.node == 18) {
    var temp = (msg[0])/100;
    var batt = (msg[1])/1000;
msg.payload = [{
    temp: temp,
    battery: batt
},
{
    device:"th18"
}];
msg.measurement = "iot";
return msg;
} else {
    return null;
    }

```

 ![emon](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/82235616d8082056359f704ae0a3f4e6d15e423e.png)  
...so, I've got 4 sensors, and the 'if' condition only runs the function if the incoming flow contains `msg.node == 18`  
`device:"th18"` is the tag  
`msg.measurement = "iot"` is the measurement

---

_[View the full topic](https://discourse.nodered.org/t/mqtt-json-influxdb-grafana/7108)._
