[mqtt] Force incoming values to be treated as int

I have a thing that uses this configuration:
Type dimmer : Brightness [ commandTopic="com", stateTopic="stat", formatBeforePublish="%.0f", min=0, max=254, step=1 ]

When I send the command 85 to this channel it gets transformed and published as 216. Then that gets delivered to the device, which sets itself to the 216 and publishes the new status, 216. The 216 arrive at openHAB, then openhab does the division by 254 and multiplies that with 100 and the result is 85.03937007874015748031496062992126. So the item changes to it. This breaks my rules as they detect this as a change that was caused by an external device, so what I would need is a way to turn the incoming value into an int so there is no change and my “changed”-rule isn’t triggered. Is there any way to do this without a transformation? I think using a transformation would make this even more complicated so I hope there is something easier, just like I can force the outgoing value using the formatBeforePublish option.

Can your device not handle decimals at all?

No the device does not handle decimals. There is a gateway that writes this onto a bus, and the value on the bus is a single byte, so this has to be between 0 and 254 (255 is reserved).

Sure, you can change your Rules to handle the floating point number. This sort of thing is what Transformations are for.

Then I need to set the max and min to 0 and 100 and use my old transformation again (that’s how it was in the openHAB 1 Binding). I thought this was no longer necessary…

The rule is just unhappy with the change, if there wouldn’t be a change (so if the 83.xxx would be truncated to 83) this wouldn’t be an issue. So I was hoping for some way to limit useless decimal places without a transformation).