Configure topics MQTT OUT node

Good evening
I'm setting up to receive data from a solar inverter through nodered.
I receive a frame of information that I transformed into a table.

I want to send this data through the MQTT OUT node but I can't configure it to create a payload per information.
This information arrives en bloc on the MQTT broker of my Home assistant.

If anyone can advise me, that would be great.


If you want to send each array element to the same mqtt topic then slpit it with a split node, or possible use the split you already have, before the join.

I don't know how to do this

Then you really need to read the documents and watch the video here

There is also a cookbook example of Splitting an array

Thank you very much so I manage to have all the data in unicast then in array and vice versa.
Now I don't know how to configure the MQTT OUT node to send to home assistant in topics like this:

Please show us the arrays in a copyable form, and where they are in the flow, so i can make you an example
Use the copy value icon described here


Like this ?

data retrieved from "join" node

And what are the mqtt topics, how do they relate to the array elements?

in fact this is where I don't know what and how to do, I ask myself the same question

where can i find this information

If this is home assistant I can not help, as i do not use it.
Maybe ask on the HA forum. If you can discover the topics you wish to send to, i can then help further.

Show us the data that you start with from the inverter.

(229.5 49.9 230.2 50.0 0897 0789 011 368 50.40 000 032 0035 00.0 000.0 00.00 00016 00010000 00 00 00000 010��


Are there some docs to tell you what the numbers mean?

I think you could use a CSV node to split the data up and create an object with named properties.

So the idea is to send a topic for each of the array values you have parsed after the join node.

You push it into a "change node", inside it you create a msg.topic as you want. Then you send all this in the MQTT out.
Here is an example that pushes the value (msg.payload) of the photovoltaic voltage.
Capture d’écran du 2023-02-25 21-29-33
Capture d’écran du 2023-02-25 21-29-49
Capture d’écran du 2023-02-25 21-30-07

I don,t know what topics you wish to send to, but here is an example i think may help

I removed the ( and ��
from the incoming string, and parsed by the csv node, you can give each value a name in column input field. I have just named them a to u, you can omit values by removing the name but leave the commas. In the csv node example i removed e.

The topics i have dynamically created with a string and the value's name that is entered in the csv node. e,g, my/unique/topic/a to my/unique/topic/u


[{"id":"c7b2ae1208cd57f5","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"(229.5 49.9 230.2 50.0 0897 0789 011 368 50.40 000 032 0035 00.0 000.0 00.00 00016 00010000 00 00 00000 010��\"","payloadType":"json","x":150,"y":440,"wires":[["d76a3f354a1061b6"]]},{"id":"d76a3f354a1061b6","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$substringBefore($substringAfter($$.payload, \"(\"),\"��\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":480,"wires":[["31c2626a7557ccf8"]]},{"id":"31c2626a7557ccf8","type":"csv","z":"65617ffeb779f51c","name":"","sep":" ","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"a,b,c,d,,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":450,"y":480,"wires":[["33bdcc643ff92f79"]]},{"id":"33bdcc643ff92f79","type":"split","z":"65617ffeb779f51c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":190,"y":540,"wires":[["5d7d8b5fa42333b4"]]},{"id":"5d7d8b5fa42333b4","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"\"mt/unique/topic/\" & $$.parts.key","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":540,"wires":[["2917b89b0a387815"]]},{"id":"2917b89b0a387815","type":"debug","z":"65617ffeb779f51c","name":"mqtt node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":540,"wires":[]}]

Hope it helps

1 Like

whooohh the change node for the msg.topic is impressive

it works like thunder

Now I want to configure my MQTT OUT node for each information like this:

  • Configuration topic: homeassistant/sensor/Grid-Voltage/config

  • Configuration payload no1: {"name": "Grid Voltage", "device_class": "voltage", "object_id": "Grid_Voltage","unique_id": "Grid_Voltage" ,"state_topic": "homeassistant/sensor/Grid-Voltage/state", "unit_of_measurement": "V", "value_template": "{{ value}}" }

  • Configuration topic: homeassistant/sensor/Grid-Frequency/config

  • Configuration payload no1: {"name": "Grid Frequency", "device_class": "frequency", "object_id": "Grid_Frequency","unique_id": "Grid_Frequency" ,"state_topic": "homeassistant/sensor/Grid-Frequency/state", "unit_of_measurement": "Hz", "value_template": "{{ value}}" }


But where do i enter this information ?