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