Getting value from MQTT message


I am trying to retrieve the value for "accumEnergyTotal" in the image below so I can output this in the message payload. I have tried and tried and as yet not succeeded. Could someone help me please? Cheers Daniel

looks like msg.payload.states[2].accumEnergyTotal.value

There are buttons at the right hand side of the debug pane that let you copy an object's path. Very useful


I tried this (see image below) but it still comes up with the full message.

Cheers - Daniel

Have you deployed the change?

Where is the debug connected in your flow (before/after the change node)?


Thanks for coming back. Yes, all deployed. See images below. Dan

That shouldn't happen!

Can you see what you get if you change the debug node to show the complete message?

Did you use the copy path button - that path looks incorrect.

oops my mistake, well spotted!

It doesn't explain why the whole payload is still there though.
If you set msg.payload to something that doesn't exist, it should become Undefined?

So if I use copy path beside the value I get this. payload.states[2].value

and if I use the copy path beside accumEnergyTotal I get this payload.states[2].name

Fixed it :slight_smile: changed it to this 'msg.payload.states[2].value'

Many thanks to both you and J (in previous reply). Happy man now I can see how the utility is going to rip me off for power I buy... (40p + per kWh) - Dan

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