Widget - icon (png) not found with long icon names

Hi!
I’m trying to adapt a weather widget i found on the “main UI examples thread” and would like to use my png icons.
but the icons won’t show up:

- component: oh-icon
  config:
    icon: =items.forecastCode_0.state + '_' + items.TagNacht.state
    style:
      height: 60px
      margin-bottom: 0px

i have the icons in the icons\classic\ folder:

a_Nacht.png
a_Tag.png
b_Nacht.png
b_Tag.png
c_Nacht.png
c_Tag.png
etc.

forecastCode_0.state = c
TagNacht.state = Tag
so i assume that the config in the widget means icon: c_Tag, right?

with the developer tools i can see that the browser is looking for the icon but doesn’t find it:
Failed to load resource: the server responded with a status of 404 (Not Found)

when i just use icon: =items.forecastCode_0.state the browser finds the icons named

a.png
b.png
c.png
etc.

without problems.

so i rewrote the icon: line to shorter names:

- component: oh-icon
  config:
    icon: "=(items.TagNacht.state == 'Nacht') ? items.forecastCode_0.state + 'n' : items.forecastCode_0.state"
    style:
      height: 60px
      margin-bottom: 0px

and these icons:

a.png
an.png
b.png
bn.png
c.png
cn.png
etc.

so in the and my widget works but i still don’t understand why the first approach failed.

1 Like

Lowercase filenames only, for use with the icon picker server.
This is documented.

oh come on! i “invested” so much time in this “issue” and in the end it’s so simple.
and i even read the Items | openHAB sections a few times and replaces all hyphens ("-") because according to this artice they are reserved for dynamic items.
in the previous line it clearly says " * Icon filenames may include lowercase letters, numbers and underscores (_)"
i feel pretty dumb now :roll_eyes:

thanks @rossko57 ! again.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.