Modbus transformation not working

Hi everyone,

I’m using OpenHab 2.0 and i have a thermostat which is communicating over Modbus TCP/IP protocol.
For modbus temperature like 20 degrees celsius is written like 200 and we need to multiply or divide temperature by 10.

In documentation i saw that openhab supports modbus transformation so i did one using JavaScript but it’s not working.

Item

Number zelena_temperatura_modbus "Number [%.1f]" <temperature> {modbus=">[slave1:0:transformation=JS(multiply10.js)],<[slave1:0:transformation=JS(divide10.js)]"}

When i run log:tail command i can see this error.

Binding configuration of type 'modbus' of item 'zelena_temperatura_modbus' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: Invalid number of registers in item configuration

Can anyone help me?

Does it ‘work’ without the transformations? What does modbus.cfg look like for slave1? Are you using modbus binding version 1.10 (not standard in OH2.0)?

I’m using OpenHAB 2.0 and Modbus Binding - binding-modbus1 - 1.9.0

Thermostate is working and i was succesfully reading setpoint from thermostat untill i added transformation.

modbus.cfg

tcp.slave1.connection=192.168.1.199:502:500:3000:300:3:1000
tcp.slave1.type=holding
tcp.slave1.id=1
tcp.slave1.start=0
tcp.slave1.length=10
tcp.slave1.valuetype=uint16

This is how it looks like in Modbus Poll


First line is the setpoint 14,0 degrees celsius and is the data i need to work with.

As said by @rossko57, you need to have binding 1.10.0 version, not 1.9.0.

Thank you for your answer. You can delete this forum post since i asked the same question in modbus transformation topic :slight_smile: