Factor problem with % Items

Hello everybody,

I am a absolute beginner and did everything with your tutorials. Now I have a problem with getting a 0.1 back, not a 10.

I have a Rasperry PI with openHAB 2.4.0. On it, i have installed, a Modbus connection to my devices, Openhab Cloud and the Hue emulation. The idea is to be able to control the devices with Alexa. With normal switches this works fine so far.

In addition to the switches I would like to use roller shutters. I created these as a workaround as a dimmer. That also works. But I have the problem that Alexa gives me 10% as 0.1 back. But my Modbus device wants to have 10 as value.

Switch swLight_Kitchen "Light Kitchen"  ["Switchable"] { channel="modbus:data:TEST:Home_Bits:Light_Kitchen:switch" }
Dimmer noShutter_Kitchen "Roller shutter Kitchen [%d %%]" ["Lighting"] { channel="modbus:data:TEST:Home_Words:Shutter_Kitchen:number" }

I would be very pleased about a suggestion or a tip.

Best regards
Heiti

You can use a transformation Profile. You would probably need to use the JS transformation.

The binding itself doesn’t appear to support transformations itself.

An alternative is to use a proxy Item and a Rule to multiply the incoming value before setting the Proxy Item with the result.

In fact the modbus binding supports both read and write transforms; these are set up in the data thing.

But applying a transform for Alexa will mess up your UI sliders etc., which presumably work ok.

Have you tried using the provided modbus dimmer channel (instead of number) with your Dimmer Item?

Hello,

Thank you very much for the quick answer.
Is it possible to adjust something on the Modbus thing? It is not a device but a PLC function what processes it.

Bridge modbus:tcp:TEST [ host="1xx.1xx.1xx.xxx", port=xxx] {
      Bridge poller Home_Words [ start=12288, length=36, refresh=1000, type="holding" ] {
		Thing data Shutter_Kitchen [ readStart="12288", readValueType="int16", writeStart="12288", writeValueType="int16", writeType="holding" ]
        }
}

Need a bit more guidance about “something” and what you want to do it.

The binding doesn’t care about what is on the other end, it just reads and writes 16-bit registers.

Did you try dimmer channel?

Dimmer noShutter_Kitchen "Roller shutter Kitchen [%d %%]" ["Lighting"] { channel="modbus:data:TEST:Home_Words:Shutter_Kitchen:dimmer" }