I need to perform an arithmetic operation between 2 variables of the same modbus device

I have converted MOT32 to float using a function, but when I take these two converted values ​​to another function to perform the arithmetic operation, there is a conflict between the payloads. I would really appreciate your help!

Welcome to the forum @Monobeto93.

If you spend a short while looking through other posts you will find countless examples where people have expected a function node to simultaneously know the contents of two completely different input messages.

It just does not work that way.

You need a join node to combine the two messages into one.

1 Like

You may benefit from watching the essentials videos they are a great source of information and will give you the basics of node-red and the uses for the standard nodes. There is also the cookbook with many examples of using the standard nodes. Take a look at Flow conrtol and Create a single message from separate streams of messages, which is an example of joining messages.

[edit] Or wire the modbus nodes in series and move each msg.payload to a new message property betwenn reads. e.g Modbus Serial - Whole bus disconnects when one device drops - #16 by Steve-Mcl

1 Like

Or even better, if the modbus addresses are not too far apart, read them both with one Read and decode the values using the buffer parser node. Then you will have both values in one message.

2 Likes