There are lots of ways you can do this but you don’t provide much information like:
what version of OH you are running?
is it only display that you care about?
what have you tried?
Keep in mind you likely will not find a step by step tutorial that shows exactly what you want to do. You will find several small and focused tutorials (e.g. how to set up an MQTT thing, how to transform a state’s representation in it’s label, etc.). There is a whole lot of OH you need to know and understand from receiving a message on MQTT and displaying it on a sitemap. Do you know the basics of it all (Things, Channels, Links, Items, Transformations, Sitemaps)?
rule "Sensor Voltage"
when
Item Sensor_Voltage changed
then
var Double reading = (Sensor_Voltage.state as DecimalType).doubleValue
var Double result = reading / 1000
postUpdate(BatteryVoltage, result)
end
and then you use this item in your sitemap or HabPanel.
Will take a look at that, thanks Hortus!
Being originally Home Assistant, I’m getting my head around OpenHab2’s process’.
This does seem like a more configurable system than Home Assistant. I’m really liking it!
For now, seeing as I already use Node-Red for automating a solar power dump and charge process, I’ve simply modified the MQTT reports from the controllers before they hit OpenHab2 (with unit converter and function nodes), then just added the modified topic as a sensor in OH.
Often it is going to be easiest to “fix” stuff like this at the source. But for sake of completeness, assuming OH 2.5.4 with the 2.5.4 MQTT binding some additional thing you could do:
JavaScript transformation on the incoming topic to convert from mV to V
the Rule like Roland posted
JavaScript transformation on the Item label to convert from mV to V
That wasn’t clear to me. Good to know that you can use m , 'k`, etc with ISO units. Because some of the units seem to have a separate entry with kilo and such in the table I erroneously assumed if it wasn’t in the table with that it wasn’t supported.