I’m trying to setup a binding between OpenHAB and Homeseer and I’m having some issues with comma separated decimal values in temperatures.
How can I make the MQTT Binding accept (convert on the fly or whatever) values with decimals separated by commas?
For example, this item:
Number TestTemperature3 “Temperatura Despacho [%.1f ºC]” (gDespacho,gTemperaturas) {mqtt="<[mymosquitto:homeseer/5/value:state:default]"}
As a workaround I wrote a flow in node-red to sustitute commas into dots but I will be very thankful if someone tells me how to fix it so I don’t need to use these calls for such a simple thing.
Here are the relevant snippets for doing it in a Rule, but they can equally be applied into an Item Transform (as long as the Binding supports Transforms):
import org.openhab.core.library.items.*
rule "test european-formatted-number"
when
Time cron "0/5 * * * * ?"
then
var out = transform("JS", "europeanNumber.js", "23,4")
logInfo("test-number", out)
end
It’s not 100% correct, since I should also transform “.” into “,” for the 1000’s separator (etc). Not sure why the MQTT/HomeSeer app is encoding it’s numbers that way. I suspect if you switched the openHAB Locale settings, prior to startup, that you could get it to work also.