Hi,
unfortunately i can't get it to extract the needed values out of a data output (from MobileAlerts).
Basically I can get the data out using the Node function, but the output of Mobile Alerts returns many records at once and with the same names.
So for example for "t1" there are several records and I can't target them.
How can I read out the values as "t1", separately from "Meerscheinhaus" and "Hot Pot"?
function node:
return { payload: msg.payload.measurements[0].t1};
Also, there is a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
in my payload there are two values for "t1"
one under: name: "Meerschweinhaus"
t1: 8.8
an one under: name: "Hot Pot "
t1: 8.7
how can i get these tow different values, my function node extract only one of them
Instead of using you mouse to drag and select the payload data, please use the Copy Value button
Also, please paste this copied data in a code block: in order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)
I think you need first to use a Switch node on msg.payload.name so that the Meerschweinhaus data goes down one path and the Hot Pot data down the other. Then you can use the function to extract the data.
There are more efficient ways of doing it but if you check that simple method works first then we can improve it.
I have already tried this, unfortunately it seems to be possible with the MobileAlerts node only to deliver all data at once at a node. When I create a second MobilieAlerts node, the first one does not anymore return any data. Yes, otherwise this would be a good way to separate this.
Would be great if you have another tip for me.
Why have you specified msg.payloadpayload.deviceid in the switch. Looking at your earlier post where you showed us the data it appears to be msg.payload.deviceid