I need MQTT node that have input and output

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:

// 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:

// 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:

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

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 :slight_smile:
Denis

2 Likes