Sitemap icon does not respect transformed state of item

OH2 v2.2 release version


Contact	myContact	"myContact [MAP(]"	<wallswitch>  {...}

Map file:


As you can see my Item type is a Contact so the native states are OPEN or CLOSED.
The wallswitch icon is a dynamic icon with sub-icons for on and off. I am trying to make the icon reflect the transformed state of the contact item.
When I view the item in a sitemap, the icon is the default switch icon without the dynamic on/off state applied. The MAP transform is clearly working as I can see the transformed text value in the sitemap (i.e. ‘On’ or ‘Off’).

How can I make the sitemap icon respect the transformed state of an item?

I know I could achieve this with a proxy item and rules but I would like to avoid that if possible as this seems like something that should be achievable without that extra overhead.


The state name must reflect the Item’s raw state. Transformations applied in the state presentation definition of the Item have no influence on icon selection.
Take note, that the Transformation used in the Livingroom_Light_Connection Item doesn’t effect the needed state specific icons - the icon selection considers “myerror”, not the contents of the file.

A solution could be to copy the wallswitch-icons as …OPEN / …CLOSED
Custom Icons
or to use a second switch-item for the presentation und set the state in a rule.

Thanks for your reply.
That is a shame that transformations can’t be applied to the icon selection.

I tried your suggestion: I added the following files to ...OpenHAB2\conf\icons\classic:

But the icon still just shows the default regardless of the state of the item.

It is clear from the chrome dev tools that it is looking for an icon with state ‘OPEN’ but for some reason it is not finding it.

…Ok, figured it out.

  1. You can’t reuse the name of an existing icon in the base installation. In my case i was trying to ‘extend’ the wallswitch icon with additional states and this doesn’t work. I went with wallswitch_contact-open and wallswitch_contact-closed instead.
  2. You must have a default icon. i.e. without a state. So I added wallswitch_contact.svg

Gotcha 2 is in the docs but I don’t think gotcha 1 is there. It was this post that pointed me in the right direction [SOLVED] Custom Icons

1 Like