I am adding my homemade air sensors into OH3 (stable release). The battery voltage is an item linked to an mqtt channel with Voltage property - it seems to work properly as the “V” unit is added.
I use a JS transformation to get the battery level
var batt_level = (voltage - 3.5)/0.7;
and I define a dimensionless item
Question - why does the value still have the “V” unit as the parallel item linked to the same channel?
I cannot use use the %% label formatter, of course (it returns 1%).
Any explanation for this behavior?
I think you have a variation of this problem
The OH framework is applying the default channel formatting suggested by the binding to the output of your transform profile, in this case adding " V".
It’s not yet clear if/how they’ll fix this bug.
You should be able to circumvent by removing the units from the channel, and have MQTT deal with number only.
thanks - I will try it and post the results here.
Has the issue (bug?) already filed?
Yes, as referenced in the other thread that you read
I have now reprogrammed my (ESP-based) sensor by deleting the battery voltage unit in the source code.
I also had to clean mosquitto DB according to this tutorial
In mosquitto, I read
openhabian@openhabHost:~ $ mosquitto_sub -v -t homie/esp_gateway/kidsBedroomTH/battery/#
I am now able to link this channel to the existing equipment and getting voltage (w/o unit) and battery level (in %) right.