Dynamic custom icons in HABpanel not working

Tags: #<Tag:0x00007fc2026f0718> #<Tag:0x00007fc2026f0510>

Hello,
got my OpenHAB 2.5 installation up and running, now I am trying to use custom dynamic icons.

I have a Contact entry in homematic.items:

Contact Wetterstation_aussen "Wetterstation Batteriestatus [MAP(de.map):%s]" <WetterstationBatterie> {channel="homematic:HG-HM-WDS10-TH-O:ccu:OEQ1296638:0#STATE", autoupdate="true"}

custom icons are in /etc/openhab2/icons/classic:

WetterstationBatterie.svg
WetterstationBatterie-on.svg
WetterstationBatterie-off.svg

Also tried a custom widget:

<widget-icon iconset="stefans_icons" icon="WetterstationBatterie" size="50"></widget-icon>

This screenshot shows my dummy widget settings when entering the text for the .svg icon (sorry in german, but I think you know the menu):

As you can see, the image next to the icon Name “WetterstationBatterie” is not showing a battery symbol and when I click “show image” I get the following error:

HTTP ERROR 404

Problem accessing /icon/WetterstationBatterie. Reason:

Not Found

What is wrong ?

OK, regarding to the docu I have to use a Switch and a String value in homematic.items file, her my try:

Switch Wetterstation_Batterie "Wetterstation Batterie Status" <WetterstationBatterie>
String Wetterstation_Batterie_Connection "Wetterstation Batterie [MAP(error.map):%s]" <myerror>

But I am not sure if I have to use this syntax as the paper UI already has all switches defined. In Paper UI the item is called

homematic_HG_HM_WDS10_TH_O_b09eabc7_OEQ1296638_0_LOWBAT

That’s the reason for using a Contact entry. But also, in the Contact entry I use a homematic channel, no idea if that is good. Help is appreciated.

Was right according to the docu, I need to add the channel to the switch:

Switch  WetterstationBatterie   "Wetterstation Batteriestatus" <WetterstationBatterie> {channel="homematic:HG-HM-WDS10-TH-O:b09eabc7:OEQ1296638:0#LOWBAT"}
String WetterstationBatterie_Connection "Wetterstation Batteriestatus [MAP(de.map):%s]" <myerror>

I have a myerror.svg icon now also.

So is that right ?

I think you put your icons in the wrong folder. The “icons/classic” should be in the config folder.

Edit: The “on”/“off” part in the icon resembles the state of the item it is used for. If you want to use it for a contact you have to use “open” and “closed”.

Well that’s the big problem for me: where is the config folder ? Is it /etc/openhab2 or /var/lib/openhab2 or even /var/lib/openhab2/config ?
I tried all 3, copying the icons/classic folder with the files, no success.

History: I used a raspbian buster image from last years semptember, updated all packages, installed homegear and openhab2 through “apt install”. The packages were updated in the meantime multiple times. Should be a straight forward installation.

To be save I now have on/off and open/closed state icons.

It’s exactly where your put you items-files. Have a look at https://www.openhab.org/docs/installation/linux.html#file-locations.

Yep, I read that docu before and put the svg-icons into /etc/openhab2/icons/classic, but weird it’s not working.

Maybe the permissions are wrong on the folder.

/etc/openhab2/icons and /etc/openhab2/icons/classic have owner:group openhab:openhab and permissions chmod 755, files have same owner:group and chmod 644.

Does it work in BasicUI?

Couldn’t test it with Basic UI, but with Classic UI. There it worked as soon as I renamed the WetterstationBatterie.svg to battery.svg, same with the on/off icons.

Then I removed the custom widget and the homematic.items file and it works in HABpanel as well.

So you have the following item:

Switch Wetterstation_Batterie "Wetterstation Batterie Status" <WetterstationBatterie>

When you name the icon “battery.svg” it is working? I don’t see how. Your icon should be named “WetterstationBatterie.svg” (the same name as in the item definition). Are you sure you don’t have defined the same item somwhere else with a different icon (e.g. in PaperUI)? Check your logs if there are entries/errors when you change your item-file (at least there should be an entry that it is reloaded).

Edit: Maybe try doing all in lowercase and name it “wetterstationbatterie.svg” (also in the item definition)

I know what you are saying, but it only works with battery as custom icon name:

It shows the icons I copied from this openhab2 web page.

I will check with “wetterstationbatterie.svg” and other situations later today.

Sorry, i missunderstood you. I thought your custom-icon was working with “battery”. With the default-icons it is working. For me it also works with custom-icons (also dynamic ones).

But battery.svg is in the standard icon set

Yes true, but they don’t work the same way. I just selected the eclipse battery icon and it shows a different battery icon for the current state. I believe they don’t work for dynamic icons. Do they ?

They actually do work the same way. I con confirm that dynamic-icons are working in HABPanel. I did it the same way you described it, so I assume you did something wrong. With the informations you gave until now I can’t tell you what is wrong. So please have a look at your log-files.

It’s working now, even though I had to use a proxy item for the humidity as it is bugged (see forum posts).
It worked as soon as I installed the Classic UI in addition to the HABpanel, only then the classic icons were available. But custom icons work also.