In MQTT, if you define the unit advanced parameter it will append that unit to the incoming number and strip it from outgoing messages (I think). But the description of unit for the HTTP binding in MainUI implies that it will append that unit to messages in either direction.
Unit to append to the (transformed) value.
But the docs imply it only appends it to incoming and is silent on outgoing.
If a unit is given in the unit parameter, the binding tries to create a QuantityType state before updating the channel, if no unit is present, it creates a DecimalType. Please note that incompatible units (e.g. °C for a Number:Density item) will fail silently, i.e. no error message is logged even if the state update fails.
So I’m not sure what it’s supposed to do for outgoing.
I think a transformation is the best approach for now.
As to whether it’s a bug, I can see times where someone would want/need the units so I don’t think it’s fair to always strip them all the time. But it seems like it might be a reasonable default behavior.
Given the similarities between MQTT and HTTP, I’d try to define the unit parameter and see what happens. It might strip the units and the docs just don’t tells us.
As for the %2s, I think there are places in some bindings where that won’t work for quantity types at all. And even with Item labels and other places where it’s used, I think f and d will only work with quantity types if you also supply the units, or indicate the default units (%UNIT% if I recall correctly).