How to split a payload ? And display information on Dashboard

Hello everyone,
I'm a French student who discovered Node-Red one month ago.
I need help because i want to split the information of the payload
Capteurs
And display the information on differents gauge, so i try to use the split node but i don't know how to use it.
Hope you can help me !

You don't need the split node if you receive this object.

You can connect the device directly to the gauge nodes and use mustache format in the value field:

{{msg.payload.payload_fields.analog_in_1}}

3 Likes

First of all thanks for your answer.
I already tried it before but i have a mistake when i do that here it is :

See here https://nodered.org/docs/user-guide/messages
To work out what your msg properties really are

1 Like

Yeah so i use your link and I see I can copy the path so it's work.



Now i will try to add the notifications if the temperature is too high for example if I need your help I will come back.
Thanks for your help and your reactivity !

So I wanted to have the value of battery in %.
But in my payload it's the value in Volt (3.3V for example).
I tried to write the calcul in the value format but it doesn't work, so do I need to use a function before ?

the way you have the gauge set up, it will show the value it gets on a gauge set to show values between 0 and 100. So, currently (no pun intended) your 3.3 volts is being assumed to be 3.3 percent.

So you need to calculate how much 3.3v is of the total voltage of the battery. You could use a function node or a change node or range node (and probably others) to calculate the percentage. Check out all three and see which makes the best sense and/or is easiest to use.

1 Like

(which of course begs the question... is 3.3V 100% ? most Lipos can go up to 4.2 (or at least 3.7) - 3.3 is only the nominal voltage... - and of course has nothing to do with battery capacity... :slight_smile:

2 Likes

Hello just wanted to give some news about my project !
This is my flow now :


For the value of the battery i use this function : Function
And this is my final dashboard :
My question is do you think i can put all my device (8 on total) on the same flow and choose which device i want to show on the dashboard with a dropdown node ?
Thanks in advance

Would it be possible...maybe.

First off, backup your existing flow so if things don't work, you could recover.

If all the devices have a unique identifier, I'd have the dropdown (with the value set to the unique identifier) connect to a change node that stored that value in a flow variable.

Next I'd have all the device nodes feed to a switch node that would compare the device's unique identifier against the flow variable. If it matches then send that data thru otherwise dump it.

Depending on how ofter the devices send data, it might take a moment for the data to be updated.

Oh, it looks like most devices don't have a sound gauge.

Yeah i will try to do this.
And for the sound don t worry we just had for one device because we need to calibrate the sensor.

This don't do exactly what I wanted to do. Do you think there is a way to choose which device I want to show on the Dashboard ?
Do you also know if i can use the level of this : node-red-contrib-ui-level, for display the temperature because i try to play with it but it seems like he don't want to take value.

Yes! Use a ui_dropdown. Here is a demo flow showing how it can be done:


multi-device-guage-demo.json (5.9 KB)

Okay i will try it today !

So i have some trouble to do that.
My device send payload like that : Payload
So for example i just try to display the temperature of 2 devices and choose which one I want to publish here is the flow :


Switch
Do u have any idea why it doesn t work ?

Yes, but seeing as you are a student, you will have to work for the answers in order to learn.

What big difference is there between my flow and yours?