Failure with dynamic icons?

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


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?

That is exactly correct.

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

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.

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.

I use this as part of a custom weather widget:

<style type="text/css">
.winddir {
  transform: rotate({{itemValue('WindDirectionDegrees')}}deg);
<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:

Nice, but not for Basic UI… :wink:

How to use that with dynamic icons?
I uses @vzorglub windrose script which report with compass displays. But I cant figure how to use these for dynamic icon like JensH is trying.

What do you start out with? Your Item has a string state of e.g. “NNW” ?

You’d make a set of items like rose-nnw.svg, rose-n.svg, rose-nw.svg etc.(note lowercase only - you must also have a default rose.svg)
It’s in the docs

Ahh just ignore my stupid question… Suddenly I had a thought that it was only possible to use numbers for dynamic icons… Makes no sense, since I have custom made icons using on/off as well… Guess it was a temporary brain damage :slight_smile:

Got to add a new comment on this anyway… I´ve ran into a strange issue with dynamic icons…
Last night I created 35 icons to make it dynamic for openweather wind direction… I have made dynamic icons before… But either I´m becoming totally blind, or there is a issue with dynamic icons in openhab 2.5M1 build 1575.

Problem is - I cant get it to work. BasicUI reads the default (new) icon allright, but all icons with suffics doesnt show… I tried both using Windrose.js as well as creating a scale. None of it works…
Strange thing though… First I created a few icons just to test. It was working fine. Then suddenly it didnt anymore. And I have no idea why… Either something is wrong, or I made an mistake I simply cant see.
So I guess I need some fresh eyes on this:

Here is a screendump of the sitemap (BasicUI) with the icon involved (red circle):

Notice the value on the right (SSE):

Here is a list of the icons I did:

Notice there is a windrose-SSE.svg in the folder:

This is the windrose-SSE.svg file as its was suppose to look:

This is my items file:

Number:Angle localCurrentWindDirection      "Current wind direction [SCALE(windDirection.scale):%s]" <windrose>        { channel="openweathermap:weather-and-forecast:6f8991c0:local:current#wind-direction" }
Number:Angle localDailyforecastHours03WindDirection  "Wind direction for today [JS(windrose.js):%s]" <windrose>          { channel="openweathermap:weather-and-forecast:6f8991c0:local:forecastHours03#wind-direction" }

Notice, one using windrose.js and the other using scale… I had to test both to try something…

Anyone god any ideas, clues… anything. It really drives me nuts, cause I have alot of other icons working just fine.

Lowercase. Icon names must be all lowercase. Its in the docs.

Just tried with lowcase (again)… Doesnt make any differences.

Well, it’s messed up now. Restart and see what’s left.

Didnt help restarting openhab…

Something is messed up though, cause I now get a strange error in another sitemap (not the one involved with the icons). Will post this other issue in a new thread.

Dynamic icons work in general, but there are simple rules (like the non-obvious default icon requirement). There are many places a mess up can linger - browser cache, apache, blah. It will come out in the end if you’ve got everything right now :smiley:

Thats it, I believe I got everything right… It´s not a cache issue… Just tried from my phone as well as a tablet… I´ve ran out of ideas… This is really frustrating.

Try lowercase string for item state like „ssw“ and try again please

In the scale transformation??

If you made it there? Maybe take a new item as setpoint with 2 ore three values like n s w to test. If that works, it‘s a problem with your .js files