Strange modbus float32 value

Then maybe your address boundary is wrong. openHAB modbus binding uses register addressing, starting from zero. Many manufacturers data sheets give register numbers, which start from 1.
So far as I can see from your screenshot though, the addressing is correct.

Okay, so your bus monitor shows a return of data bytes
01 04 04 65 43 E0 8E
That will be 16-bit input registers 4 = 6543 and register 5 = E08E
There’s two ways to put those together as a 32-bit float
“ABCD” 6543E08E (OH float32 type) = 5.7812735 E22, quite large number
or
“CDAB” E08E6543 (OH float32_swap type) = -8.208545 E19, quite a large negative number
Neither of those values looks particularly sensible,

If you are expecting around 230 - a voltage perhaps? - then the returned registers must be byte-swapped in the way you did in the screenshot, "BADC`
That is an unusual way to do it, but as I said there are no real rules.
But because it is unusual (I’ve never seen it before) there is no provision for it in the OH Modbus binding.

I think perhaps you will have to fetch the registers as a 32-bit integer and use either a rule or a transform to treat that as bytes, rearrange, and then do IEEE754 convert.
Or fetch as four bytes, and convert in a rule.

This old post has a bytes-to-float rule snippet

1 Like