Contact item, switch item, and icons

Trying to set up my sitemap to get the functionality that I’m looking for. Here are the appropriate sections of my items and sitemap files:


Switch GDreq {mqtt=">[openhab:home/garage/door:command:ON:OPEN], >[openhab:home/garage/door:command:OFF:CLOSE]"}
Contact Garage_Door <garagedoor> {mqtt="<[openhab:home/garage/door_state:state:default], >[openhab:home/garage/door:command:OPEN:OPEN]"}


Switch item=Garage_Door label="Garage Door" icon="garagedoor" mappings=[OPEN="OPEN"] visibility=[Garage_Door==CLOSED]
Switch item=Garage_Door label="Garage Door" icon="garagedoor" mappings=[CLOSED="CLOSE"] visibility=[Garage_Door==OPEN]

Switch item=GDreq label="Garage Door Request" icon="garagedoor-closed" mappings=[ON="OPEN"] visibility=[Garage_Door==CLOSED]
Switch item=GDreq label="Garage Door Request" icon="garagedoor-open" mappings=[OFF="CLOSE"] visibility=[Garage_Door==OPEN]

My problem is that I can’t get both functionality and the appropriate icon to display. The functionality of the “Switch item=GDreq…” works, but the displayed icon is always “garagedoor”. The icon shown with “Switch item=Garage_Door…” is appropriate (garagedoor-closed when contact is closed, garagedoor-open when contact is open), but the functionality of the switch does not work.

The Contact Garage_Door is being successfully updated by a remote sensor that makes mqtt posts to the appropriate topic.

Can someone point to my error? Thanks!

In OH 2 they changed how icons work so you can no longer refer to the state icons directly (i.e. you can use garagedoor but not garagedoor-closed).

The only way I found to work around this was to make a copy of the garagedoor-closed and garagedoor-open icon files in the icons/classic folder with new names, in my case gdclosed.png and gdopen.png.