openhab-core
openhab-core copied to clipboard
[FR] Dynamic icons not only for 0-100
Dynamic icons are at the moment only available for number values between 0 and 100. For several QuantityTypes there are higher values possible, for example: pressure, CO2 (ppm), distance in meter and many more.
It should be possible to have dynamic icons for those as well.
When I have looked correctly it should be very easy to do so by removing this if-statement: https://github.com/openhab/openhab-core/blob/3811cb95604f69f6a3d77da2caf391d81b05458e/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/AbstractResourceIconProvider.java#L111
But I don't know why this restriction was introduced before, maybe some performance issues.
@kaikreuzer I have seen you have initial contributed this code. Maybe you can explain me why this restriction is needed?
Thanks in advance
The restriction is there because we only provide those for percentage values out of the box. All other cases very often highly depend on your individual use case (and also the unit that is used). Also, as you can see in line 112, we are iterating over every single integer in the range, so this mechanism simply won't work for any natural number.
Thanks for explanation. Yes I have seen this iteration. So you mean to use it with natural number the algorithm should be changed. To scan for all files in directory per wildcard matching for example battery-*.svg and then iterate only over this results. I can try to make a draft for this.
Are there any other known IconProviders beside the CustomIconProvider in this Project and the ClassicIconProvider in webui?
Are there any other known IconProviders beside the CustomIconProvider in this Project and the ClassicIconProvider in webui?
No, at least not in the official codebase.
@DerOetzi Are you still interested and working on this?
@J-N-K Yes I'm still interested in this feature but have no time at the moment to have a look on this. I have a workaround on this by scaling down and up for the gui items
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Let's keep this feature request opened.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.