[SOLVED] Using Standard Icons Dynamically


I hope everyone is well.

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%).

Any help would be greatly appreciated.

Thanks in advanced!

Jeevs :slight_smile:

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.

1 Like

@opus Thanks for the response! Scratch the lightbulb - got that working.

How would you suggest i do the thermostat?

Thank you

I’d go for icon “temperature”, although I don’t know on which temperature which level will be displayed.

Unfortunately I cant go with temperature as it’s either on or off. Not a specific temperature :frowning:

Any other input from anyone? Another example, if the garage door is open show a open garage icon otherwise, closed garage icon.


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.

I made my own dynamic items. Just recolour them. Name them something heating-20, heating-40, heating-60 and so on.

1 Like

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.

Thank you!

If I do my own items, do where do i place the images? Also, how does the OH know which icon to display?

Thank you!

Standard available icons

Thank you @rossko57 for the list of standard icons. Now, how would I go about changing and using them within my OH?

For instance, if my garage door sensors is open (sonoff sv) how can I update the garage door icon? Would this be in form of a rule?

Thank you once again!

You need 3 icons. garagedoor.svg, garagedoor-open.svg and garagedoor-closed.svg

Place the icons in the conf/icons/classic folder
Specify which icon to use by this item in your items file or paperUI (Not both)

Did you look at the documentation for icons?

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 :slight_smile:

That’s great all - thank you.

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?

Thank you.

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
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.

No through your mqtt channel

Of course you would need to set the icon to be used in the sitemap file. Add the
to the respective definition line for the garage-switch. But you have read that in the posted documentation links, don’t you.

Thank you all for your input so far, it is most appreciated. I think it will help if i provide my items file:


// Rear Garage Door
Switch                  Rear_Garage_Door            "Garage Door"                               <mygaragedoor>  (Ground_Floor, Rear_Garage)    ["Switchable"]  { channel="mqtt:topic:oh:rearGarageDoor:power" }

// Rear Garage Door Sensor
Contact                 Rear_Garage_Door_Sensor     "Garage Door Sensor [%s]"                   <contact>       (Ground_Floor, Rear_Garage)    { channel="mqtt:topic:oh:rearGarageDoor:contact" }

The above works correctly, including the contact, what i would like if possible is based on the contact item to update the garage icon.

Is that possible?

Thank you all once again

If you change the state of the Item, and there is an icon filename version to match the state, the visible icon will change.

If you want to change the icon from someicon.svg to differenticon,svg, not really, no.