# I need MQTT node that have input and output

**URL:** https://discourse.nodered.org/t/i-need-mqtt-node-that-have-input-and-output/28451
**Category:** General
**Created:** [17 June 2020 06:33 UTC](https://discourse.nodered.org/t/i-need-mqtt-node-that-have-input-and-output/28451 "2020-06-17T06:33:01Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![denisjoshua](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@denisjoshua](https://discourse.nodered.org/u/denisjoshua)
#### Post date: [17 June 2020 08:50 UTC](https://discourse.nodered.org/t/i-need-mqtt-node-that-have-input-and-output/28451/9 "2020-06-17T08:50:57Z")

</div>

Thanks a lot all guys... Colin give me an idea on how to solve this.

So I don't use a Join Node but all of thinks is go in a Function Node

We know that every time the MQTT topic will change, that will start the MOTT Node  
...in that case in the function node I just change a flow variable in base of topic name.  
And I make available all variables like this:

```auto
// is Tesla M3 on charge 
var M3OnCharge =flow.get('M3OnCharge') || 0;
if (msg.topic=="teslamate/cars/1/charger_power")
{
    flow.set('M3OnCharge',msg.payload)
}

```

But I will return message in output only if the topic is from battery capacity:

```auto
// when the powerwall_battery_capacity change, return the msg and start flow 
if (msg.topic=="sensor.powerwall_battery_capacity")
{
    var PWBattPercentage = flow.get('PWBattPercentage') || 0;
    // % level of PowerWall battery
    flow.set('PWBattPercentage',msg.payload);
    return msg;
}

```

Here is the test flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c23cb040217f7738ce2e8090a52e1baa708971c7.png)

So now everything is work great... and I have all day to change all production flow 🙂

Ii think this is the easy and funny programm laguage that I find in my 25 years of programmer.  
In just 2 days a learn a lot of thinks and I can make a lot with it.  
Thanks a lot all of you for great support and I'm glad to be member of this community 🙂  
Denis

---

_[View the full topic](https://discourse.nodered.org/t/i-need-mqtt-node-that-have-input-and-output/28451)._
