Java Runtime Environment: openjdk version “1.8.0_222”
openHAB version: 2.4.0
Issue of the topic: Dynamic Icon with dash-character in raw state
Is it somehow possible to create dynamic icons when there’s a dash character in raw state?
I have devices which are presenting states like “AUTO-MODE” or “MANU-MODE”. I already tried to put in icon files named “device-auto-mode.svg” or “device-AUTO-MODE”. But OpenHAB always displays the default icon “device.svg”. What am I doing wrong? Or is it not possible?
Also all UIs (PaperUI, ClassicUI, BasicUI) don’t show the raw state of the channel. They always display something like a translation in my language (Auto-Modus, Manu-Modus) and I don’t know why.
I created a map file with content:
Not possible. It’s a limitation due to the way dynamic icons are served, the - dash character has special significance. Including it in icon filename or in string Item state breaks the method.
Some bindings can make default suggestions for the contents of selection boxes, because a binding may know about the device by discovery. The binding can provide different defaults for different locale/language.
If you look at your Item with REST API you will likely see the added data.
When you add your own maps and mappings etc. it should override those defaults.
If the binding is providing states that prevent dynamic icons from working, that could be considered a bug. Perhaps an underscore would be better.
OK. I have found a solution which is working for me. I just created a dummy Item where I can change the states and a rule where it sends the command to the devices if the state is changed. Also when the state on the device changes the dummy Item is also changed.