MQTT: Automatic quantitytype conversion (kWh -> Wh) does not work

Tags: #<Tag:0x00007f616b6a3b40> #<Tag:0x00007f616b6a3a00> #<Tag:0x00007f616b6a3848>

I use MQTT2 generic binding with a Sonoff POW, which provides todays and total energy consumption in kWh:

Type number : today "Energy today" [ stateTopic="sonoff3/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today", unit="kWh"]
Type number : total "Energy total" [ stateTopic="sonoff3/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total", unit="kWh"]

With the configuration unit="kWh" I try to tell the MQTT binding, that this is measured in kWh, not Wh, MWh or the like.
Since I use OpenHAB 2.5.6 (and the 2.5.6 mqtt binding), this should be supported.

Now I try to use different units in for both values via items configuration:

Number:Energy Lueftung_E  "Verbrauch heute [%.3f Wh]" <energy> {channel="mqtt:topic:luv:sonoff3:today"}
Number:Energy Lueftung_Et "Verbrauch gesamt [%.3f kWh]" <energy> {channel="mqtt:topic:luv:sonoff3:total"}

Please note, that the first line uses “Wh”, while the second uses “kWh”.
I expected that the first line should automatically convert from “kWh” (from the channel definition) to “Wh” (in the item definition), but only the unit was changed but not the value, so 0.163 kWh (from MQTT) is “converted” to 0.163 Wh instead of 163 Wh.

Changing the item definition from Wh to kWh shows correct data (0.163 kWh), but isn’t what I want to see, since such small values make much more sense to show in Wh instead of kWh.

Is there any other way to let OpenHAB handle this conversion job?
I expected https://github.com/openhab/openhab-addons/pull/6763 to address this issue, but it still doesn’t work as I expected.

Greetings
Roland

I think the underlying issue is that the MQTT number channel remains a number channel, not a true quantity type.