Xml query possible?

Hi, is it easy possible to query one value of this xml:

its just from another RPi http://ip from RPi:8080/semp

i need AveragePower 288 every 60s for some calculations in my exisiting flow.

greetings

Hi @Becker

What have you tried so far? The flow will be something like an Inject node set to trigger at whatever interval you want, an HTTP Request node to get the data, an XML node to cover the XML to a JavaScript object and then a Change node to pull out the particular value you want.

If you can get as far as passing the data through an XML node, wiring in a Debug node to see the structure of the JS object you end up with. From there you'll be able to identify the proper path to the property you want using the Debug sidebar tools.

1 Like

thx

i need:

payload.Device2EM.DeviceStatus[0].PowerConsumption[0].PowerInfo[0].AveragePower[0]

I don´t know how to use a change node to pull out the value

got it:

var semp = msg.payload.Device2EM.DeviceStatus[0].PowerConsumption[0].PowerInfo[0].AveragePower[0];
msg.payload = semp
return msg;
[{"id":"845e4937.cc4fc","type":"inject","z":"341cac4c.e11094","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":160,"wires":[["3fb43d2d.fb57f2"]]},{"id":"34f4aa79.9d9b4e","type":"xml","z":"341cac4c.e11094","name":"","property":"payload","attr":"","chr":"","x":630,"y":160,"wires":[["b8b1c3fe.c2d848"]]},{"id":"3fb43d2d.fb57f2","type":"http request","z":"341cac4c.e11094","name":"Abfrage SAE","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.168.5:8080/semp","tls":"","persist":false,"proxy":"","authType":"","x":450,"y":160,"wires":[["34f4aa79.9d9b4e"]]},{"id":"b8b1c3fe.c2d848","type":"function","z":"341cac4c.e11094","name":"","func":"var semp = msg.payload.Device2EM.DeviceStatus[0].PowerConsumption[0].PowerInfo[0].AveragePower[0];\nmsg.payload = semp\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":160,"wires":[["53e9af3.63139d"]]}]

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