MODBUS/TCP word swap configuration

I have a slave that sends 32bit data with the words swapped from what the current binding is expecting.

For example if my UINT32 register contains 0x12345678 and I read it I get 0x56781234

I’d like to have a slave configuration option something like

modbus.tcp.slave1.wordorder= [normal | swapped] and of course
modbus.rtu.slave1.wordorder= [normal | swapped]

Obviously the default would be normal!

I could give it a go, since i clearly have the motivation and means to test it…

But before I do… has anyone done something like this already?

Tom

Out of curiosity what are you talking MODBUS to that requires such crazy byte manipulation!?

I am using a Productivity 3000 PLC, I will likely replace it with the newer P2000

I am looking at installing 15-20 Thermisitors throughout my house to track the temp change throughout the day, etc.

Thermisitors are nice since they do not require special wire and you can get the raw sensors from Amazon/ebay for under $2 each.

I am in a single story home so getting access to each room is not a problem.
I think I can push the sensor (about the size of a small LED) out by the light fixture or fan.
If that does not work I may be able to drill a small hole and caulk it in the attic.

I am going to mount the PLC in the garage.

Eventually I will have the PLC control my Heating/AC accepting most control from OH but adding ladder logic to perform sanity and safety checks.

Tom

1 Like

Well I got thinking about it and since my PLC has the word swap option I was able to re-write the tags I wanted to read from OH to the PLC over MODBUS with the word swap disabled and then OH had no problems reading the word swapped copy…

But it still would be a useful feature if the binding had that option…

SO I guess the only questions that remain are…

How do I figure out who maintains that binding?
What is the best way do make a enhancement request?
(If the best way is to just do it then that will bring up a host of other questions!!)

I’m more than happy to make the changes if they will work there way into the main distribution and eventually OH2

Tom

@w2vy, you might interested to comment to existing issue #3558.

I think the only way to implement with the current binding is to use openhab rules to do the byte swap

Best,
ssalonen