If I in PaperUI set the category of an Item to something that matches an existing icon in the classic icon set I’ve noticed that it automatically gets the correct icon in both PaperUI, BasicUI and the app. So I thought that I could simply do the same for icons that seem to be missing from the classic icon set. I have set category to “car” on an item and put icons (tried both car.png and car.svg) in /etc/openhab2/icons/classic but I get no icon. What is the correct way to do this? The documentation only mentions Items declared in .item files from what I can find.
I’m not certain that PaperUI supports custom icons.It not intended to be a user’s interface so I wouldn’t be surprised if it only supports the built in icons.
I don’t really care for PaperUI, it is in BasicUI and the apps I want to see them.
Noticed something interesting thing though: When I turn the device on I actually get my nice little car icon (with the setup described above). So it works half way
edit: I’ve now also tried making some copies of car.svg called car-off.svg and car-on.svg but that didn’t make any difference, it still displays icon only when on.
I misread your post. I thought you meant that the icon was working in BasicUI but not PaperUI.
Unfortunately, I don’t have anything to recommend. What you did seems correct. Are you certain your BasicUI is configured to use svg icons?
If you have every icon as bitmap (i.e.
*.png) and as vector image (
*.svg) then putting them to classic folder should suffice. If you only have png, you would have to change configuration of your favorite UI to use bitmap icons. This is done in e.g.PaperUI/confgiuration/Services/UI/Basic UI.
App (like iOS) use bitmap always, default for BasicUI is SVG.
Yep. And just to be sure I removed the png file. Still works fine when the Item is off but not when it’s on. Weird…
This is only a guess:
Some icons might have an empty bitmap in the embedded icon set, so that would maybe found before searching the custom path !?
For me custom icons are working in iOS app and BasicUI, but:
- I always ues my own naming (like icon=“mycar”).
- I have filed a bug because values larger than 100 do not seem to work.
I am not sure if with “in PaperUI defined items” you imply that you do not want to remap the icon in your own *.item file, but when you go via sitemaps, you can always override any default.
Unlikely as there must be a default for dynamic icons to work at all.
What I meant above is I don’t think you can change the icon for an item as the item appears in paper UI. You can set the icon in PaperUI by entering it in the Category field.
With “empty” I was meaning that the icon file exists, but it is all transparent. I have observed cases where some icons in the classic icon set do not show up if I use them on any item with a null state.
In the end, my suggestion for the original problems is simply: use “mycar” and not “car” to rule out any problem and have full control.
Ok, this is getting weirder. I tried copying my “car.svg” to a “bil.svg” and changing the category of the item in PaperUI to “bil”. Result of that was that the icon worked fine in basicUI both for off and on. Now I got no icon whatsoever in the app though.
Changed category back to “car” and it still works in basicUI for both off and on (!). In the app it’s back to only showing the icon for on and nothing for off.
I’m really failing to find the logic here
If by app you mean the phone app, I think the iOS app, perhaps the Android app as well, only support png icons if I recall correctly.
This sounds like a caching problem in the app. I’ve found that when I mess around with icons sometimes I need to completely close the Android app and restart it to pick up the changed icons.
The iOS app has a “Clear Cache” menu entry in the Settings.
Ok, think I’ve solved this now. I set the category to “bil” and made sure I’ve got both a bil.svg and a bil.png in the folder. And then I wiped the cache of the (Android) app. Don’t know exactly which of the steps made it work. Also checked in iOS, looks good there too. Thanks for the hints!