I'm new to this, so much to learn with Home Assistant, Tasmota, Grafana and now Node Red.
I'm trying to construct a Node Red Dashboard to display and control my Owl Intuition Electricity monitor and Central Heating system.
Stuck on how to get the "current power" value out of the json payload to feed into a gague.
The message comes in OK via UDP Multicast node which then goes through a switch node to separate the flows for the 3 different message types. Each then goes through a XML node which puts it into a jsons format (I think).
Originally I had that output going to the gauge with the path to the element I wanted copied from that element in the debug window. Although the gauge showed the right level the text was the whole thing so I read somewhere to get just the value I wanted by a function node.
So I put the path into the function but I get the error that it is returning a string.
What am I doing wrong?
My line in the function is:
return msg.payload.electricity.chan[0].curr[0]._;
The payload it's trying to read is:
{"electricity":{"$":{"id":"443719002FAD"},"timestamp":["1606673600"],"signal":[{"$":{"rssi":"-53","lqi":"12"}}],"battery":[{"$":{"level":"100%"}}],"chan":[{"$":{"id":"0"},"curr":[{"_":"1384.00","$":{"units":"w"}}],"day":[{"_":"19130.05","$":{"units":"wh"}}]},{"$":{"id":"1"},"curr":[{"_":"0.00","$":{"units":"w"}}],"day":[{"_":"0.00","$":{"units":"wh"}}]},{"$":{"id":"2"},"curr":[{"_":"0.00","$":{"units":"w"}}],"day":[{"_":"0.00","$":{"units":"wh"}}]}]}}