I have problems to convert float and 32b (signed/unsigned) registers to obtain a result able to be sent to MQTT broker. The modbus device is a semaphore/Servelec Tbox unit. I use node-red modbustcp
Example: I have a float register with a value of 22.362 in it. I want to pass that value to my MQTT broker.
When I debug in node-red, I obtain an array: [16818,58720] but I'm stuck to convert this to a readable precise value of 22.362 (22.36 will be ok)
I have no probs with int16 registers (because they are 16bits obviously but need to find a function to convert negative values to readable ones)
I found here a function but the result seems weird (imprecise).
*Edit: I made my test simple. That's the reason I set the value of 22.362 into register 22362 ! Easier to remember