Parse input mqtt from nodemcu

Hello Together,
I am new in using node-red and need your help.
I have this one as input as mqqt in node-red and i am interesting in getting an output value just for the Power_curr value.´

image

The change node does not work when copying the value Power_curr it is "payload[""].Power_curr" and the node change marks it as red...

Has someone any ides?

Thanks

hover over the copy path and click on it to see what that give you
image

Your payload looks a bit odd for tasmota, what sensor is this for ?

Normally there is the sensor type object containing the data eg

image

Yes I was also was reading it like it is missing a property name, this is strange, never seen this before (how is it even possible ?)

Out of interest, what do you see if you tell the mqtt node to return a string? Also what if it returns a buffer? I wonder if there is an unprintable character as the key name.

hi i used it and it gave me this here
payload[""].Power_curr"

it a sensor for smart meter to read out and show the current power electricity usage of the house

this how it looks inside the console

Try setting your MQTT node to keep it as a string and then do a replace "" to something like "xx" in a change node then feed onto the JSON node and you should be able to get a sensible reference to it

payload.xx.Power_curr

image

I'm using Tasmota 12.3.1 (yours says 12.3.1.3) on a Wemos D1 Mini connected to a PZEM-004T to send readings to Node-RED via MQTT.

I have a MQTT-In node configured like this..
hes_mqtt

Which gives object-data like this in a debug node...
home_energy_sensor
Note: I have a section named ENERGY, which seems to be missing in your object.

Using my Node-RED flow, I just pull-out the data I need and display on my dashboard.

You can see the object name is "" in that shot, not sure why, did you change any settings relating to topics structure on tasmota setup ?

May be worth asking on tasmota discord

Does the sensor actually have a name in the tasmota config, what kind of module is it and/or are you using a template ?

Thanks to all your support

not really.
I habe used now a different smart meter code and i have now this one.

now i have main instead ""

using a change node

but still i do not get a single value

i get this one.

i changed also the version to 12.3.1

i need just the single value for power

Can you please try my idea and see if it works for you - it works for me :slight_smile:

it worked now. Thanks to everyone.
I needed to delete the debug node and recreate it. Something was there wrong.

Thanks

1 Like

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