@fohdeesha Unfortunately I cannot reproduce the issue. Perhaps the issues are caused by something with your hardware/software/devices?
Please find the steps I used:
- Install 1.8.3 runtime openhab
- Install modbus 1.9.0 SNAPSHOT (2016-09-07)
- Configure
openhab.cfg
as follows
modbus:tcp.slave1.connection=127.0.0.1:55502
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.start=0
modbus:tcp.slave1.length=2
modbus:tcp.slave1.valuetype=uint16
# another slave reading the same registers as float32
modbus:tcp.slave1float.connection=127.0.0.1:55502
modbus:tcp.slave1float.type=holding
modbus:tcp.slave1float.start=0
modbus:tcp.slave1float.length=2
modbus:tcp.slave1float.valuetype=float32
- Configure
default.items
as follows
Number Item0 "Item0 [%d]" (ALL) {modbus="slave1:0"}
Number Item1 "Item1 [%d]" (ALL) {modbus="slave1:1"}
Number Item0float "Item0 [%f]" (ALL) {modbus="slave1float:0"}
Number Item1float "Item1 [%f]" (ALL) {modbus="slave1float:1"}
- Start Modbus/TCP server
./diagslave -m tcp -p 55502
- Start openhab
./start_debug.sh
6.a. If necessary, install python 2.7.
6.b. Download Pollmb from http://mblogic.sourceforge.net/mbtools/mbpoll.html
Startup log from openhab
20:49:11.422 [INFO ] [runtime.busevents :26 ] - Item1 state updated to 0
20:49:11.423 [INFO ] [runtime.busevents :26 ] - Item0 state updated to 291
20:49:11.476 [INFO ] [runtime.busevents :26 ] - Item0float state updated to 0.000000000000000000000000000000000000029938371747505134968578758682379069606944138399039104063426020019278439576737582683563232421875
Test A: Single register, 291 (uint16) or 0x0123 (hex)
pollmb/pollmb.py -h 127.0.0.1 -p 55502 -t 2 -f 16 -a 0 -q 1 -d 0123
20:49:49.529 [INFO ] [runtime.busevents :26 ] - Item1 state updated to 0
20:49:49.529 [INFO ] [runtime.busevents :26 ] - Item0 state updated to 291
Test B: Single register, 3000 (uint16) or 0x0BB8 (hex)
pollmb/pollmb.py -h 127.0.0.1 -p 55502 -t 2 -f 16 -a 0 -q 1 -d 0BB8
20:33:38.075 [INFO ] [runtime.busevents :26 ] - Item0 state updated to 3000
20:51:25.132 [INFO ] [runtime.busevents :26 ] - Item0float state updated to 0.000000000000000000000000000000070874221953450279392459988287125325322202140654326285584829747676849365234375
20:51:25.192 [INFO ] [runtime.busevents :26 ] - Item0 state updated to 3000
Test B: Two registers, 0x42C8999A (hex) = 100.3 (float)
pollmb/pollmb.py -h 127.0.0.1 -p 55502 -t 2 -f 16 -a 0 -q 2 -d 42C8999A
20:52:03.522 [INFO ] [runtime.busevents :26 ] - Item0float state updated to 100.3000030517578125
20:52:03.582 [INFO ] [runtime.busevents :26 ] - Item1 state updated to 39322
20:52:03.582 [INFO ] [runtime.busevents :26 ] - Item0 state updated to 17096
Please note that 0x42C8999A
matches the uint16 items as well (you can check these online)
0x999A (hex)= 39322 (uint16)
0x42C8 (hex) = 17096 (uint16)
In all the above cases the values remained constant after the write.
Extra: Documentation for pollmb here