I’ve done a lot of searching around the last couple of days, but cannot find a difinitive guide on how to have dynamic standard icons on the sitemap. I’ve seen guides where Rules are used to manage this, but all of these sound like custom icons.
I’ve already read the guide to dynamic icons here I understand the concept of ON, OFF etc. However do not understand how this can be achieved.
I have two scenarios; 1) I have a lightswitch which is using Shelly1 I’d like the lightbulb icon to be dynamic i.e. lightbulb.off or lightbulb.on. 2) Nest Thermostat that is linked and I am currently using the heating logo, i would like to have heating.on (100%) or heating.off (0%).
How did you define those items and how did you call them for the sitemap?
Please post the lines from from your .items file or the settings from PaperUI and the lines from your sitemap.
At least for the switch it should be working “outof the box”, can’t say the same for the thermostat simply because I’m not using such.
Well there are few choices if you want only standard icons…for the thermostat maybe you can go with fire icon, can be on and off…as it’s controlling the heating it’s not so out of scope.
For the garage, you didn’t say the value of your garage item…if i remember right there should be a garagedoor icon
edit: the heating icon should support either numeric value or on/off . So I think it’s the best.
Thanks for the response, there is a heating one too, but how do I achieve the dynamic icons? Do i need to download the icons and place them in a folder? Or use rules to do this?
Yes, correct I’ve seen there is a garagedoor icon, there’s even open and closed I believe.This returns on/off.
You just need to put the icon name in the item definition…if you are using PaperUI it’s a field called “Category”, you can even override the icon in the sitemap adding icon=“youricon”.
If you use standard icons and the item value is consistent to the one the icon is expecting, the “magic” will happen automagically
I have downloaded the 3 icons. garagedoor.svg, garagedoor-open.svg and garagedoor-closed.svg and placed them into conf/icons/classic.
Now my issue is I’m using a Sonoff SV flashed with Tasmota and using MQTT, I’m using GPIO14 and ground for my contat switch. (This is working) What I’d like is based on state of the contact change the garagedoor icon. Would this be achieved through rules?
A word of warning; the icon selector first looks in it’s “standard set” of icons (which is not accessible to you) before searching in the custom icons folder.
Don’t use the same filenames as standard icons ! Use new names like mygarage.svg etc.
No. You seem to have missed the essential points. The UI asks for icons based on the Item state. You tell openHAB the default icon filename, and openHAB treats that as the “root” of a set.
So if you have an icon set mygarage.svg mygarage-open.svg mygarage-closed.svg
and you have set your Item’s icon (or category) to mygarage …
if your Item has state “OPEN” the displayed icon will be mygarage-open.svg by magic.
If your Item has a state “FRED” the displayed icon will be mygarage.svg by magic.
Of course you would need to set the icon to be used in the sitemap file. Add the icon="mygarage"
to the respective definition line for the garage-switch. But you have read that in the posted documentation links, don’t you.