Problem with join Node and AHOY DTU PV data

Hello,
I am a newbee with Node-Red and just got stuck a bit.

I have some data from by PV-inverter:

Now I want to join them all together, so that I can store them in InfluxDB.

image

image

But there come no data through to my test/out topic. If I transfer just 1 value, then data comes to my MQTT test/out-Topic. I just need to use this, as debug nodes do not work at the moment.

Actually it should be very easy to join the data togehther:

the output JSON should look sth. like:
{P1_DC: 46.3, P2_DC: 53.5}

and so on...

I also tried to create a json manually with a function node:

msg.payload = {
    P1_DC: msg.payload,
}
return msg;

This works for 1 value or I can create different function nodes for each value, but I do not know how to combine it into i JSON-Object.
{"P1_DC": 46.3}

What is the best solution to combine such values or is there an even easier solution?

Stefan

Your join node has no count so will never output a message unless it receives a msg.complete. Add a count of 2.
Here is an example to get the output format you wish after the join. It uses a template node.
e.g.

[{"id":"0cdeae66f0415454","type":"inject","z":"da8a6ef0b3c9a5c8","name":"ch1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ch1/p_dc","payload":"{\"p_dc\":10,\"otherproperties\":10}","payloadType":"json","x":110,"y":2160,"wires":[["63e1903885bbc34a"]]},{"id":"63e1903885bbc34a","type":"join","z":"da8a6ef0b3c9a5c8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":330,"y":2180,"wires":[["85388a7f93835ad3"]]},{"id":"05088f33f95829a7","type":"inject","z":"da8a6ef0b3c9a5c8","name":"ch2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ch2/p_dc","payload":"{\"p_dc\":20,\"otherproperties\":20}","payloadType":"json","x":110,"y":2220,"wires":[["63e1903885bbc34a"]]},{"id":"85388a7f93835ad3","type":"template","z":"da8a6ef0b3c9a5c8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"P1_DC\": {{payload.ch1/p_dc.p_dc}}, \n    \"P2_DC\": {{payload.ch2/p_dc.p_dc}}\n}","output":"json","x":480,"y":2180,"wires":[["06c36bc61f4cdf5a"]]},{"id":"06c36bc61f4cdf5a","type":"debug","z":"da8a6ef0b3c9a5c8","name":"debug 219","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":2140,"wires":[]}]

Thank you very much. Now it works :slight_smile:

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