Failure with dynamic icons?

(Jens H) #1

Using latest snapshot on Ubuntu 18.04 Lts

I created an own icon for a wind rose with red arrow for direction.

Saved files as
windrose.png
windrose-0.png
windrose-22.png
windrose-45.png

Until
windrose-360.png

As shown in screenshot dynamic item only works for degrees until 100. the degrees over 100 (next would be windrose-112.png) Fall back to windrose without arrow: windrose.png

Could it be openhab only supports dynamic from 0 to 100?

0 Likes

(Rossko57) #2

That is exactly correct.

0 Likes

(Jens H) #3

Die anyone get this at a feature or bug to change in future?

0 Likes

(Rossko57) #4

It’s not a bug. So far as I know, there is no current intention to support numeric dynamic icons beyond range 0-100.

You can have unlimited icons using alpha suffixes. I wonder if you can workaround by displaying String item with a text value of “220” or whatever?

Doing it that way, you would not get the numeric magic feature of finding the “next lowest” icon, e.g. value 22 finds icon-20.svg Alpha suffix would need to be exact match.

Most people with compass displays seem to use strings “NNW” etc.

0 Likes

(Udo Hartmann) #5

I doubt that a string would work as intended, because it’s a range to be the same icon.

Maybe better create a scale transformation. Unfortunately there is no option to display the icon dependent on another item.

0 Likes

(Justin) #6

I use this as part of a custom weather widget:

<style type="text/css">
.winddir {
  transform: rotate({{itemValue('WindDirectionDegrees')}}deg);
}
</style>
<img height="92" class="winddir" src="{{ServerPath}}/weather/directionarrow.svg" style="width: 92px" />

Just pick your icon (SVG works best) and that CSS transform will rotate it from 0-359 and point exactly where the wind goes, only one image needed :slight_smile:

0 Likes

(Udo Hartmann) #7

Nice, but not for Basic UI… :wink:

0 Likes