I tried to add dynamic icons to the color items to directly see the ON/OFF state of my RGB lights.
Since I couldn’t find much information about the state representation of color items I raised the log level and found OH3 looking for icons ‘name-#123456.ending’. Were 123456 is the RGB value (‘name-#RRGGBB.ending’).
I can’t imagine how the RGB value could be useful without some kind of ‘nearest matching algorithm’ in the AbstractResourcesIconProvider.java but for the ON/OFF display this shouldn’t be necessary.
OFF will always be RGB #000000. Everything else is ON and the icon provider will redirect to the default icon if no exact match will be found.
So I made a grayscale colorwheel icon and saved everything in the icons\classic folder:
- colorwheel.svg → colorwheelstatus.svg
- colorwheel.png → colorwheelstatus.png
- colorwheel.svg in grayscale → colorwheelstatus-#000000.svg
- colorwheel.png in grayscale → colorwheelstatus-#000000.png
(I wasn’t sure, if the icon provider could combine a user icon and an internal icon. To be safe I used a new icon name.)
When the sitemap is accessed with the Android app everything works like a charm. The icon is updated as soon as the color item state changes. Just like on all other items.
But when the sitemap is accessed in a web browser with BasicUI the icon is not updated when the color item state changes. A refresh of the web page loads the correct icon. So it seems to work. Just without the automatic updates like on other items.
I tested this on Openhab 3.0.1-2 (zulu11.45.27) with:
- Android App 2.16.0 (Android 9)
- Chrome 89.0.4389.105 (Android 9)
- Firefox 87.0 (Windows 7 64bit)
- Chrome 89.0.4389.114 (Windows 7 64bit)
Is there something I’m doing wrong?
Or is it possible that there is no dynamic icon update on color items?
If so: Is this a bug? Or a feature?