Change incoming MQTT payload and send it to Tasmota

Hi there. Please I need help with convert incoming message from my ORNO WE 516 to readable domoticz values.

On input from MQTT i get this message in string form:
tele/tasmota_147B98/SENSOR : msg.payload : string[316]
{"Time":"2022-09-14T09:05:10","ENERGY":{"TotalStartTime":"2022-09-11T22:36:00","Total":7.050,"Yesterday":3.770,"Today":2.430,"Period":[ 0, 0, 0],"Power":[ 6,20,267],"ApparentPower":[71,42,689],"ReactivePower":[ 0, 0, 1],"Factor":[0.09,0.63,0.40],"Frequency":50,"Voltage":[238,236,237],"Current":[0.300,0.180,2.910]}}

I need choose one of this values like "Voltage" and send it back to MQTT with message something like this:

msg1 = {};

msg1.payload = {"command":"udevice","idx":300,"nvalue":0,"svalue":238;236;237}; 
return [[msg1]];

For correct read device in Domoticz. Can you help me please how to modifi this MQTT message?

  1. set the MQTT node to parse JSON into an object
  2. click the copy path button on the item of interest
  3. use a change node to copy into msg.payload from the msg.path_you_copied
  4. send to an MQTT out node with an appropriate topic

Thereā€™s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.


NOTE what you are doing here:

is not valid.

At a guess you want a string from the voltage array e.g. "238;236;237"

In a function node...

msg.payload = {
    "svalue": msg.payload.Voltage.join(';')}; 
return msg;

Steve Huge THANKYOU :slightly_smiling_face:

Its works.

SniĢmka obrazovky 2022-09-14 o 11.32.08

Tasmota log:
2022-09-14 11:33:10.621 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":148,"nvalue":0,"svalue":"238,238,239"}

1 Like