Extract voltage value only from ADS1x15

So i have the a/d outputing this: { ADS1115 • I2C_ADDRESS_0x48 • Channel A0-GND • Voltage: 3.2901004058961765 }
But i just want the message.payload to be the numerical voltage value so i can drive a guage with it, how?

That can be achieved by the change node, as documented here: https://nodered.org/docs/user-guide/messages#changing-message-properties

Something like msg.payload.Voltage in the "to" line should do the trick. Be aware that object properties are case-sensitive.

If that doesn't work then feed the message into a debug node and show us exactly what it shows.

Here is the debug result

{"ADS1115 • I2C_ADDRESS_0x48 • Channel A0-GND • Voltage":3.2901004058961765}

If you look in the node-red docs Working with Messages (as @kuema suggested) it shows you how you can use the buttons in the debug pane get the path to a property. In this case the path will be something like
msg.payload["ADS1115 • I2C_ADDRESS_0x48 • Channel A0-GND • Voltage"]

I would first attempt to persuade whatever node or device you are getting that from to give you a more useful property name such as "voltage". Then you would be able to use msg.payload.voltage which is much easier to type. If you want to include information about what the value refers to then the convention is to use the topic for that, and I wouldn't use special characters in there if you can avoid it, it just makes life more difficult.

That did the trick , thank you

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