I’d like to format a number (total amount of water in liters) in Main UI as
7.301 Liter (as in: 7 thousand 145 liter). Currently it’s shown as
I’m using a stateDescription to format it (currently:
%, .0f Liter). Changing it to
%. .0f Liter instead results in gibberish.
Question is: What do I have to do?
My local raspi is set (under raspi-config) to the profile
Changing the openHAB Regional Setting to “German” (though I’d like to have openHAB in English) doesn’t make a difference.
Update: Read through this thread here Number formatting (thousands separator) - #28 by Simsala , but am a bit hesitant, since the thread is rather old and maybe I’m just doing something wrong.
The “print” formatting is done by Java utilities, so it is the Java locale options that you need to set, as per the thread that you found.
Assuming you run openHABian, please update to latest and use menu 32 to re-set the locale and let me know if that fixes it.
I’m running openHAB on Docker, not openHABian.
Will try @rossko57’s hint and report back.
Java, unless instructed different, should reuse the system locale settings so it’s rather about getting those right.
Thanks a lot for all the hints!
So just to double-check, to not mess up the wrong parameter, before I keep messing around with internals:
My raspi-config is set to the profile
de_DE.UTF-8 → Ok from what I can see.
In my openHAB "Regional Settings, the measurement system is set to “metric” and language is “English” → Ok from what I can see.
In the karaf-console, as mentioned here, the reading
user.country is the one I have to change as described in the post, if I want to keep openHAB’s language as “English” and the number formating with “.” as thousand separator. Correct?
Observation: Strangely I do not see any entries with something
read more carefully (“zu generierende Locales”)
again read more carefully : country (i.e. locale) is DE
Thanks for all the hints. I managed to solve the problem myself based on the hints above.
Fun fact: My case illustrates how important it is to state the overall setting in which you’re operating in when opening a new post here in this forum: Since I’m running on docker (but forgot to mention this),
raspi-config doesn’t even play a role, since this changes the Raspbian-variables, and the ones that are relevant for openHAB are (in my case) the ones of the docker container and thus defined in my docker-compose.yml. As a result the problem is also fairly easy to fix.
Here’s what I did to solve the problem:
Access terminal of the openHAB docker container via
docker exec -t -i openhab /bin/bash
locale proves that the reason why “,” is used as a thousand separator in openHAB is because all variables of the openHAB container are set to default (here: ```
- In the docker-compose.yml I added the following to the “environment:”-chapter
“Update the stack” (I’m using Portainer)
Thanks for everyone involved.