Thanks!
I could reproduce the issue myself. It seem that verbose logging is not very verbose by default openhab2 and that’s why we were missing critical information.
When setting debug level logging in core openhab:
log:set TRACE org.eclipse.smarthome
You can see the core reason
18:37:54.168 [DEBUG] [home.core.internal.items.ItemUpdater] - Received update of a not accepted type (DecimalType) for item Dimmer1
The reason is that internally the default transformation is not converting between DecimalType (not accepted by Dimmer) and PercentType (accepted by Dimmer). This is actually logged by the binding as well (I know, hard to miss and certainly unclear from docs)
18:49:01.619 [DEBUG] [nternal.ModbusGenericBindingProvider] - Item 'itemName' is of type 'DimmerItem'. Please make sure that transformation is in place to convert the polled data to a format understood by the item. Furthermore, make sure that commands are converted to DecimalType or any command accepted by Switch, Contact or Number items.
You can have working configuration as follows:
Dimmer Dimmer1 "Dimmer [%.1f]" (ALL) {autoupdate="false",modbus=">[slave2:1],<[slave4:1:transformation=JS(identity.js)]"}
where
identity.js
:
(function (inputData) {
return inputData;
})(input)
Now the “dummy” identity transformation is used to convert numbers to percents. In case numbers would exceed 0…100, the data will be ignored by openHAB.
Best,
Sami