I realized now that this wasn’t a problem before.
On my second stable installation the percent values get changed to decimals too.
This must have happened through an update.
Unfortunately I don’t know how to contribute to solve the issue. I can only give out logs.
I tried a workaround and just multiplied the outgoing value times 100.
openHAB is realizing it is out of range now.
2020-04-30 08:53:07.883 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '5434.96' not supported by type 'PercentageValue': Value must be between 0 and 100
My second question is solved:
2020-04-30 08:48:38.645 [vent.ItemStateChangedEvent] - OU_Backyard_AbsoluteHumidity changed from 11.32 g/m³ to 11.29 g/m³
I havn´t tried myself, but I would assume a JS script in the transformation path for the thing could be used to multiply by 100. It works for modbus, where I use it. But I´m not sure MQTT support it (It should do as default, in my opinion).
This is how it looks like in modbus2 binding:
Thing data inp204 [ readStart="204", readValueType="int16", readTransform="JS(divide100.js)" ]
This is the script for multiply by 100:
// Wrap everything in a function
return Math.round(parseFloat(i, 10) * 100);
// input variable contains data passed by openhab
So if you insert this part into your thing setup…
copy the multiply100.js to your transform folder
Make sure you have the transformation service added.
… it might work.
If not… I would say some maintainer of mqtt have a job to do