Modbus 1.x problem

I have a problem with the Modbus module on OH2.
I installed the bindings, I configured the modbus.cfg files in the services folder but I can not use the configured data.
Any idea ?

Please provide more detail regarding your configuration and .items file contents. No one will be able to offer helpful advice without more information. Thanks!

I use Paper UI and in bindings section i can’t view modbus.
My conf/items folder is empity !
Something wrong?

In order to use 1.x bindings, you must define items in .items text files that reference the bindings, just as was done under openHAB 1.x runtime. See the wiki page for what is required.

Thanks John,

Ok, i understand, now i use this register in modbus.cfg file:

tcp.slave1.connection=192.168.1.22:502:60:0:0:3:500
tcp.slave1.type=holding
tcp.slave1.id=1
tcp.slave1.start=43
tcp.slave1.length=2
tcp.slave1.valuetype=float32

I have this row in sitemap file:

Frame label=“Temperature” {
Setpoint item=Temperature_Setpoint minValue=15 maxValue=35 step=0.5
}

The value is setpoint temperature of TH Tune (http://www.carel.com/room-terminals/-/journal_content/56_INSTANCE_i4q5KIMLInKK/10191/58192) from CAREL

When I try to write the value, the setpoint to the tune th is always set to 0.

I tried to set the Directive “writemultipleregisters=true” in modbus.cfg file but the result does not change.

any idea ?

Do you have a .items file you created with an item definition that begins with

Number Temperature_Setpoint

?

Number Temperature_Setpoint “Temperatura [%.1f °C]” (Temperature, Setpoint) {modbus=“slave1:0”}

John do you have any idea ?

Does anything appear in the log? At the openhab> prompt, enter log:set TRACE org.openhab.binding.modbus and maybe log:tail. Then try to exercise the binding to see log messages showing its steps.

11:38:25.790 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Temperature_Setpoint’ received command 21.5
11:38:25.805 [INFO ] [marthome.event.ItemStateChangedEvent] - Temperature_Setpoint changed from 21.1000003814697265625 to 21.5
11:38:25.873 [INFO ] [marthome.event.ItemStateChangedEvent] - Temperature_Setpoint changed from 21.5 to 0.00000000000000000000000000000000000000200201409650390127697266859970255382801814103242984993537274710116908617296704875343493768014013767242431640625

I think you might not be reading the Modbus registers correctly – as in, the layout of the register contents might be different than float32. See this section of the wiki to see if float32_swap (or some other layout) might be a better choice?

Also, it’s possible to add to your item definition

Number Temperature_Setpoint "Temperatura [%.1f °C]" (Temperature, Setpoint) {modbus="slave1:0", autoupdate="false"}

in order to suppress the automatic update of the item to match the command you sent the item, instead waiting for the binding itself to update the item. So in this part of the log

11:38:25.790 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Temperature_Setpoint' received command 21.5
11:38:25.805 [INFO ] [marthome.event.ItemStateChangedEvent] - Temperature_Setpoint changed from 21.1000003814697265625 to 21.5

the second line should not appear, and the item remains in the state 21.1000003814697265625 until the binding changes it.

Hi Jhon, tank’s for your patience.

I tried with the autoupdate=“false” but… same problem.

I try with float32_swap but the value of TH Tune setpoint temperature not is valid.

if i read the same register with “modbus poll” software (for windows) I get the correct value with “float AB CD” display.

The value read from Modbus to OH1 or OH2 is instead the following:
The value read from Modbus to OH1 is instead the following:

13:20:11.699 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.1000003814697265625
13:20:13.709 [INFO ] [runtime.busevents 26 ] - Temperature_Setpoint state updated to 23.1000003814697265625
13:20:15.718 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.1000003814697265625
13:20:17.727 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.1000003814697265625
13:20:19.741 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.1000003814697265625
13:20:21.751 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.1000003814697265625

In this point i have changed the setpoint value on TH Tune from 23.1 to 23.3

13:20:23.761 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.299999237060546875
13:20:25.771 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.299999237060546875
13:20:27.784 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.299999237060546875
13:20:29.791 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.299999237060546875
13:20:31.805 [INFO ] [runtime.busevents :26 ] - Temperature_Setpoint state updated to 23.299999237060546875

For me the problem is the decimal side of the value.

why the decimal part has 18 digits?

Scuse me for my bad English

Because IEEE floating point numbers cannot exactly hold all possible decimal values. It’s converted to a Java BigDecimal which faithfully represents the float, but the float wasn’t exactly 23.3 to begin with. Not sure there’s any way to change that, other than UI level formatting with %.1f.

Hi,
I’m finding the registers modbus for Th-Tune Carel, but I don’t find them (on Carel site there isn’t).
Have you this information ?