Addition of 2 variables

Hi, I want to add 2 variables ¨V1¨ and¨ V2¨ that are voltage readings from 2 sensors in CA. These readings are sent via HTTP POST to node red in a STRING format, then converted to JSON, and finally extracted their value. I want to sum these 2 variables but when I do it the result is NAN

Although you have converted the data to an object, the values of the items in the object are all strings.

In the code remove the space between the parseFloat and the open (

Also, you are setting the variables to the object not the number. Just set them to msg.payload.xxx

There’s 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.

BX00Cy7yHi

3 Likes

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