Sort data from electricity meter

Hi I´m trying to sort the data from my Emeters Han-port.
"0100010700FF": [908, [0, "W"]], 908 is current power.
I´m quite new to Nod-red so Help please!

{
"elapsedtime": 58526314,
"rssi": -88,
"mac": "F4:CF:A2:D0:7B:99",
"localip": "192.168.1.90",
"ssid": "Idrott",
"hostname": "ESP-D07B99",
"header": {
"encoding": "A-XDR",
"frameformat": 3,
"segmentation": 0,
"datalength": 579,
"client": 65,
"server": 2179,
"control": 19,
"hcs": "eb85",
"fcs": "388e",
"llc": "e6e700"
},
"apdu": {
"tag": 15,
"liiap": "40000000",
"datetime": "00"
},
"payload": {
"0000010000FF": ["07E50B0505073300FF8000FF"],
"0100010700FF": [908, [0, "W"]],
"0100020700FF": [0, [0, "W"]],
"0100030700FF": [0, [0, "var"]],
"0100040700FF": [483, [0, "var"]],
"01001F0700FF": [10, [-1, "A"]],
"0100330700FF": [5, [-1, "A"]],
"0100470700FF": [27, [-1, "A"]],
"0100200700FF": [2349, [-1, "V"]],
"0100340700FF": [2335, [-1, "V"]],
"0100480700FF": [2333, [-1, "V"]],
"0100150700FF": [225, [0, "W"]],
"0100160700FF": [0, [0, "W"]],

What do you mean by sort?
do you want the path to the value?
here is some good ifo on how to obtain paths using the debug pane.
https://nodered.org/docs/user-guide/messages
the value 908 is at msg.payload["0100010700FF"][0]

I wan´t to use the value to store it in influx and put it in a graph in Grafana.

Now I tried this in a function node!
I get this:
object

payload: "0100010700FF"

topic: ""

_msgid: "23cde9b951be24d8"

statusCode: 200

headers: object

responseUrl: "http://192.168.1.90/data.json"

redirectList: array[0]

retry: 0

how? Maybe you could show us?

msg.payload = ["0100010700FF"] [0];
return msg;
msg.payload = msg.payload["0100010700FF"][0];
return msg;

``Gives:
`
TypeError: Cannot read property '0' of undefined

Then please copy the value of the object payload.
You can do this in the debug panel. hover your mouse to the right of the payload object and 3 icons will appear. One of them is copy value. paste the value here between backticks, press </> and you get
```
type or paste code here
```
You can also get the path to any value you want using the copy path button.

We need to see a clear representation of the incoming msg, or you need to learn how to find paths and work with messages. It may be a good idea to read this page and watch the videos
https://nodered.org/docs/user-guide/messages
I suspect the path is

msg.payload = msg.payload.payload["0100010700FF"][0];
return msg;

but we can not keep guessing. So if that fails please show your incoming data properly formated and between backticks as shown above.

{"elapsedtime":120979242,"rssi":-92,"mac":"F4:CF:A2:D0:7B:99","localip":"192.168.1.90","ssid":"Idrott","hostname":"ESP-D07B99","header":{"encoding":"A-XDR","frameformat":3,"segmentation":0,"datalength":579,"client":65,"server":2179,"control":19,"hcs":"eb85","fcs":"31a7","llc":"e6e700"},"apdu":{"tag":15,"liiap":"40000000","datetime":"00"},"payload":{"0000010000FF":["07E50B0700163B00FF8000FF"],"0100010700FF":[565,[0,"W"]],"0100020700FF":[0,[0,"W"]],"0100030700FF":[0,[0,"var"]],"0100040700FF":[557,[0,"var"]],"01001F0700FF":[11,[-1,"A"]],"0100330700FF":[6,[-1,"A"]],"0100470700FF":[16,[-1,"A"]],"0100200700FF":[2340,[-1,"V"]],"0100340700FF":[2340,[-1,"V"]],"0100480700FF":[2351,[-1,"V"]],"0100150700FF":[165,[0,"W"]],"0100160700FF":[0,[0,"W"]],"0100170700FF":[0,[0,"var"]],"0100180700FF":[206,[0,"var"]],"0100290700FF":[117,[0,"W"]],"01002A0700FF":[0,[0,"W"]],"01002B0700FF":[0,[0,"var"]],"01002C0700FF":[85,[0,"var"]],"01003D0700FF":[280,[0,"W"]],"01003E0700FF":[0,[0,"W"]],"01003F0700FF":[0,[0,"v...

The origin of the problem is trying to sort out data from my Aidon electricity meter
I have used info from:

Ok the data is a string add a json node after the node that is receiving the data, to convert it to a object

Or
The node you are using to receive the data may have a setting to output a parsed json object.

I finally found the solution: msg.payload = msg.payload ["payload"]["0100010700FF"][0]
Thank you for your help!

You can write that as msg.payload = msg.payload.payload["0100010700FF"][0]. I notice this was suggested by @E1cid three days ago.

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