I’m using the MQTT binding with a generic thing. I would like to make use of UoM, but can’t find any documenation how to do so. I did read: https://www.openhab.org/addons/bindings/mqtt.generic/ but it doesn’t contain any thing file examples or anything about UoM. So i guess it’s not available, but before i make a feautre request at github, i would like to ask if it makes any sense.
I have this Thing:
Thing topic cvketel "MQTT CVketel" {
Channels:
Type switch : vlam "Vlam" [ stateTopic="events/central_heating/otmonitor/flame",on="1", off="0" ]
Type switch : cv_aan "CV aan" [ stateTopic="events/central_heating/otmonitor/centralheating",on="1", off="0" ]
Type switch : dhw_aan "Warmwater aan" [ stateTopic="events/central_heating/otmonitor/hotwater",on="1", off="0" ]
Type number : oemfaultcode "Foutcode" [ stateTopic="events/central_heating/otmonitor/fault" ]
Type number : roomsetpoint "Setpoint" [ stateTopic="events/central_heating/otmonitor/setpoint", commandTopic="actions/otmonitor/setpoint" ]
Type number : overridesetpoint "Override setpoint" [ stateTopic="events/central_heating/otmonitor/remoteoverrideroomsetpoint" ]
Type number : tchmax "CV Max. temp." [ stateTopic="events/central_heating/otmonitor/chsetpoint" ]
Type number : roomtemp "Temperatuur" [ stateTopic="events/central_heating/otmonitor/roomtemperature" ]
Type number : modulevel "Modulatie" [ stateTopic="events/central_heating/otmonitor/modulation" ]
Type number : flowtemp "CV Water temp." [ stateTopic="events/central_heating/otmonitor/boilerwatertemperature" ]
Type number : flowsetpoint "CV Water target" [ stateTopic="events/central_heating/otmonitor/controlsetpoint" ]
Type number : waterpressure "CV waterdruk" [ stateTopic="events/central_heating/otmonitor/waterpressure" ]
}
Would it be possible to add UoM magic to the channel declaration:
Type number : roomsetpoint
would be something like:
Type number: temperature : celsius: roomsetpoint
or
Type number : waterpressure
would be
Type number: pressure : bar : waterpressure
Another approach could be to get the unit from the topic (if provided), downside is not all devices post the unit together with the value to the topic.