ioBroker / ioBroker.modbus

Modbus adapter for ioBroker
MIT License
50 stars 28 forks source link

Implement Float (Little Endian Byte Swap) #508

Open dieterlind opened 6 months ago

dieterlind commented 6 months ago

Is your feature request related to a problem? Please describe. To be able to read all input registers for my IDM heat pump it is required to have the type Float (Little Endian Byte Swap) available for selection.

Describe the solution you'd like Implement type Float (Little Endian Byte Swap)

Describe alternatives you've considered No alternative known

PLCHome commented 6 months ago

floatbe - Float (Big Endian): AABBCCDD => AABBCCDD floatle - Float (Little Endian): AABBCCDD => DDCCBBAA floatsw - Float (Big Endian Word Swap): AABBCCDD => CCDDAABB floatsb - Float (Big Endian Byte Swap): AABBCCDD => DDCCBBAA

Maybe the name was just chosen poorly if floatle - Float (Little Endian): AABBCCDD => DDCCBBAA Then by Byte Swap CCDDAABB so it must be floatsw - Float (Big Endian Word Swap) the same. Isn't it?

Or what is the expected result from the bytes in hex representation with the identifier AA BB CC DD of each byte sendet in order A to D?

It's actually funny that in the documentation floatsb is the same as floatle.

dieterlind commented 6 months ago

Hello! Honestly I do know too little about Modbus to judge this.

What I can say: IDM has actually a pretty good document for their Modbus interface. When I read register 1000 or 1002 it works, when I try to read 1008 it doesn't work. Both are defined in the documentation as following: image

Regarding type FLOAT the documentation gives this information: image

In ioBroker they are defined like: address name description unit type len factor offset formula role room cw isScale 1000 Außentemperatur Außentemperatur(B32) C floatsw 2 1 0 value.temperature false false 1002 Gemittelte_Außentemperatur GemittelteAußentemperatur C floatsw 2 1 0 value.temperature false false 1008 Wärmespeichertemperatur Wärmespeichertemperatur(B38) C floatsw 2 1 0 value.temperature

Error when reading 1008: image

When I try to read to read the register with Modbus Poll it works when selecting 32-bit floating little endian byte swap image

Maybe this helps!

Thanks!

PLCHome commented 6 months ago

When I read register 1000 or 1002 it works, when I try to read 1008 it doesn't work.

Ok, but it doesn't seem to be the data type. If these values are correct.

Error when reading 1008:

I think it's more of an alignment problem. He cannot access the address.

dieterlind commented 5 months ago

The strange thing is that 1000 and 1002 are correct with Float (Big Endian Word Swap) in ioBroker, but the values are wrong in Modbus Poll when setting to Big Endian Byte Swap (no word swap available). They are just right there when using Little Endian byte Swap.

But how to fix the issue in iob-modbus if the alignment seems to be right in Modbus Poll?

dieterlind commented 5 months ago

Any ideas?