Need to write one function that will return 3 values

Data is coming in below format on a single MQTT topic I had used function to split values.


{"context":{"Meter_Name":"TG1","KW":10,"AMP":5,"PF":1},"datastream_name":"MeterA","value":"300","tstamp":1596044253000}


As I said you have to make sure they have different topics. You can set the topics in the function nodes. So just add to each function lines like
msg.topic = "AMP"
Also you don't need three MQTT nodes if they are all subscribed to the same topic, Use one and wire it to all three functions. In the MQTT node there is an option to parse the JSON value coming in and convert it to a js object, if you select that you should be able to remove the JSON nodes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.