[SOLVED] Custom Icons

@milty456 did you ever solve this? I have the exact same problem.

No. I could never get these working properly…not sure who marked it as solved. I dumped the icons in every directory at every level. It never worked.

Hello!

Do you have icons in the right folder? You said you had your icons in conf/icons/basic, but icons should go to conf/icons/classic. The folder classic should not to be confused with Classic UI. It is folder for Classic icon set, not Classic UI, so, if you are using Basic UI, you should not put icons in conf/icons/basic, but conf/icons/classic too. And few remarks:

  • Don’t use uppercase letters for icon names
  • Don’t use blank/space in icon names
  • Don’t use hyphen in the name - only use it if you have dynamic icons (i.e. soundlevel-10, soundlevel-20) - you can use underscore instead

Hope this helps.

Best regards,
Davor

5 Likes

Thank you @davorf that helped. I was using capital letters.

I am running latest snapshot openHAB 2.0 and classic UI and have it configured for .png icons. All icons that are NOT part of openHAB 2.0 work fine, but ones that have the same name as 2.0 don’t work such as door-open and door-close. I would think that conf/icons/classic/door-close.png should have preference over any other 2.0 door-close icon.

This is by the way all covered in the documentation article on items for a long time: http://docs.openhab.org/configuration/items.html#icons

Could be presented clearer though.

@sipvoip I wouldn’t call them the same way but yes, I agree they should have precedence. Could you create an issue ticket?

The filename has to be all lowercase. That was the problem I had. I was using myBattery.png aus filename. It has to be mybattery.png to work. Thank you for the solution.

Hi there, I´ve a similar problem, which I described here:

Don´t want to post it twice :slight_smile:

I can’t figure out how to make dynamic icons work correctly when the text value for the item has a space in it.
Specifically, I’m using dynamic icons for the “Condition” field returned by the weather binding.

I’ve specified the icon as condition and in icons/classic I have a “condition.svg” and a bunch of others for specific values. “condition-clear.svg” or “condition-overcast.svg” will work and get correctly used for “Clear” or “Overcast” condition values, but “condition-partly_cloudy.svg” will not get used for “Partly Cloudy”. In that case, I just get the default “condition.svg” icon.

From what I’d read, I thought a space in the string would get mapped to an underscore in the file name but that doesn’t work.

What is the correct file name to use?

Thanks,
Scott

I was able to get mine working (at least for browser clients).
You need to use an actual space in the icon name for text values with spaces. For example, “condition-mostly cloudy.svg” will work correctly.

Thanks Lopez1de. That just solved a major headache I had :slight_smile:

But it should, just as documented in https://www.openhab.org/docs/configuration/items.html#icons.
Better try to figure out what is wrong about that (as it works for others) instead of doing ugly workarounds that will prevent you from ever doing a proper update again…

Hello!

You’ve said that you tried adding icons to /conf/icons, but, if I’m not mistaken (and that’s the way I’m using custom icons), icons should go to /conf/icons/classic folder. And double check if icon name has uppercase letters or special characters. If it has hyphen in the filename and it’s not a dynamic icon, it will not work.

Best regards,
Davor

Yes. And from that folder they do work as intended.

Anybody know, how can I now use cusotom icon in custom widget in HABpanel?
For other icons i am using
iconset="‘freepik-household’" icon="‘light’"

What iconset i should use for custom icon?

I dont know how you create a custom icon set. But if you want to use custom made icons, you´ll just do it the same way as if it was basicUI. But as far as I remember, it has to be SVG format only.

I have found.
iconset="‘custom-icon’"
is working

Had problems with this too: This is what I did and the mistake I found after hours of frustration:

  1. Copied a battery-10.svg and battery-90.svg into the icons/classic folders and renamed batteri-0.svg and batteri-1.svg as my batteri items states are only 0 or 1.
  2. Spent way too many hours frustrated why my icons refused to show up.
  3. Realized that a default batteri.svg was missing, copied one of the files and renamed it to batteri.svg.
  4. Icon showed up!
1 Like

A quick look into the docs would have saved you that:

A third default icon file, switch, is required as well.

Yeah I recall reading that page early on, but didn’t understand it apparently! :rofl:

1 Like