Sitemap groups not updating icon (Solved)

I have a sitemap that works however the groups icons are not updating as I expect them to when one of the items in the group changes. Visual Studio Code shows status updating properly from On to Off and Vise Versa. I read the openhab docs but it doesnt pinpoint that should be different from regular items that are working.

Here is my group item

Group:Switch:OR(OFF,ON) gLock "Locks [MAP(lock.map):%s]" <lock>

Here is my sitemap

		Text item=gLock label="Doors" icon="lock"{

			Frame icon="door" {
		        Text item=Zone01FrontDoorStatus label="Front Door"
				Switch item=FrontDoorLock label="Front"
			}

			Frame icon="door" {
                Text item=Zone04Door_ZoneStatus label="Cabana Bath Door"
		        Switch item=zone04DoorLock label="Cabana"
			}

			Frame icon="door" {
                Text item=Zone07Status label="Garage Interior Door"
	        Switch item=Zone07DoorLock label="Garage"

			}


		}	

One thing I see is glock is declared as a switch then sites as text in sitemap. Which is it?

It is defined as a switch because I need it to turn on and off as the items in the group get updated. That part is working as expected. When I turn on and off devices, the group is updating properly. The text in my sitemap is also updating properly.

In my sitemap I have it defined as a text field because I don’t want the switch to show up. I don’t want to lock and unlock the doors from there, I simply want it to show the status on the outside of the sitemap and when I click it, it shows me all the items that are part of the glock group.

I am expecting that door lock to look unlocked…
image

instead I see this…

image

Notice the text changes but no icon change :frowning:

Once I click on the line It takes me to the frame with all the door locks, where I can open, close and see more info…

For the lock icon, what is the name? Is it

Lock-on and lock-off

Or

Lock-unlocked and lock-locked?

Dynamic icons need the text to match the part after the hyphen in the name. If the icons are named on and off you may need a map transformation. The other option would be to rename the icons. I don’t remember the folder in the openhab install to find the icons off the top of my head. I believe the help docs have the names when you hover over them. I believe this may be the issue.

https://docs.openhab.org/addons/iconsets/classic/readme.html

ok I think you are on to something. I was using Locked and Unlocked and had tried On and Off but not the correct open and closed as the lock icons indicate “lock-open” and “lock-closed” when I hover over them. Thanks for pointing that out!

I have my lock.map file doing this now. It still not working though :frowning:

OFF=Open
ON=Closed
undefined=Unknown
-=Unknown
NULL=Unknown

This is what I get now when the door is unlocked… text is correct but still not working. I also tried lower case…

image

I also did some research on where those files are and they are hidden inside a jar file.

lock-closed
lock-open

Try these in your : {conf}\icons\classic folder. Rename to unlocked and locked. See if it works. If not search here for groups on sitemaps and icons. I read something last night, its possible some of this does not function as expected. But lets try one last thing first.

Ok I updated my map file to

ON=locked
OFF=unlocked

I downloaded the images and placed them in the direction, they have read permission for everyone and we’re named locked.svg and unlocked.svg respectively.

Still no change so I will continue my search.

The icon is chosen based on the state of the Item, not on the label. Your MAP is not going to change which icon gets selected.

Since gLock is a Switch, your icons need to be named “lock-on” and “lock-off” and you must have one named just “lock”.

@fifo I just tested what @rlkoshak said and it works.

I misspoke, I had the correct idea, but the wrong names for the icons.

I had lock-on and lock-off and it works great. I suggest putting a 3rd icon name lock and using an icon that is not a lock. This will let you know which of the 3 is being chosen.

@Thedannymullen I went ahead and renamed the icons as @rlkoshak mentioned. it didn’t work so I went ahead and also added the open and closed versions because that’s the name I see when I hover over the icons https://docs.openhab.org/addons/iconsets/classic/readme.html. I agree with Rich that it should be On and Off based on the switch. In this case I needed to add the on and off icons instead of the open and closed since the default icons are opened and closed. I understand that the open and closed icons are extra since those would already be in the default configs of openhab and not actually used by what I am trying to do here. Is my logic correct there?

Here are my current icons and their locations… (note again the open and closed here should really be deleted but I just added them to test)

My Items file still shows the following.

Group:Switch:OR(OFF,ON) gLock "Locks [MAP(lock.map):%s]" <lock>

Thanks for pointing out the thing about the map files I was confused about that, but am actually happy that it works that way as it provides more flexibility I think.

I restarted OH just in case but still I find that it does not update the icon. The text that is driven by the item(s) is updating correctly according to the lock.map file.

Have you cleared your cache and restarted opemhab?

ALso, when refreshing your browser hold shift then f5 . This wi l force the browser to reload the page vs cache.

Last question of you get rid of a map file what does the text say? Does it say o n off or something else?

That did the trick!!! I had to clear cache after making all the changes. Thank you so much! I now have a good understanding of how this works! Can’t wait to update my config so that all my icons are dynamic!

1 Like

Glad to be of help!