[SOLVED] Dynamic Item State won´t change icon in UI

Hey there,

i tried to get some dynamic item states working in the UI but it won´t work.
I´m using OpenHAB with CUL and Homegear to talk to my Homematic components.

I´m talking about the window and door contacts.
The value from Homegear is true or false, but in my mapping i´m using 0 or 1 to transform into closed or open.
Whatever i tried, the icons in my sitemap won´t change with the contacts value.


Number itmTuer_Flur "Tür Flur [MAP(windowcontact.map):%s]" <door> (Flur) {homematic="address=MEQ0367606, channel=1, parameter=STATE"}


Text item=itmTuer_Flur


0=geschlossen /* closed on german */
1=ge\u00f6ffnet /* open on german */

I tried the following names:
contact-open.png (renamed the windowcontact.map for this try)

But nothing changes in my UI.
I did a reboot after every change in the images folder, heard something that this is necessary.


Be aware that the icon is bound to the state itself, there is no mapping. To get the right Numbers, omit the MAP Part in item definition:

Number itmTuer_Flur "Tür Flur [%s]"  (Flur) {homematic="address=MEQ0367606, channel=1, parameter=STATE"}

and look at the UI to see, which states are reported. Then the icon has to be named >iconname<->state<.png, e.g. tuer-1.png and tuer-0.png.

If the item represents a real contact, it’s better to use Contact as item type. This will show OPEN and CLOSED as states, so the icons would be named tuer-closed.png and tuer-open.png

keep in mind, that the icon has to be referenced if you use non-default names, so add this to the item:

Number itmTuer_Flur "Tür Flur [%s]" <tuer> (Flur) {homematic="address=MEQ0367606, channel=1, parameter=STATE"}

Imho you don’t need to reboot if you changed or added icons - at least I’m not aware of such a restriction.

Hi Udo,

that´s my problem.
It would be easier to build an .map file to say which icon should be bound to which state.
As it already works to change the name of a state.

When creating the item with contact i get open and closed, while number will create 1 and 0.
As i work with numbers, i renamed the files in door-1/-0.png and contact-1/-0.png.
But it wont change the icons displayed in the UI.
It displays the icons door.png and contact.png without a state.

<li class="" style=""><img src="/images/door.png" height="29" width="29">Tür Flur <span style="">0</span></li>
<li class="" style=""><img src="/images/contact.png" height="29" width="29">Fenster Schlafzimmer <span style="">1</span></li>
<li class="" style=""><img src="/images/contact.png" height="29" width="29">Fenster Badezimmer <span style="">1</span></li>
<li class="" style=""><img src="/images/contact.png" height="29" width="29">Fenster Küche <span style="">1</span></li>

I changed the icons from the default OH1 to the OH2 png files, could this be a reason ?
The app is still showing the original contact icon but the new door icon.
The UI is showing the new contact and door icon.
None of them show the correct icon for the current state.


But why using Number instead of contact item?

1 Like

Ah. Maybe (because it’s more common to have Numbers 10 to 100 for dynamic icons) you have to use door-00 and door-01.

Hi Udo,

tried to rename the icons to door-00/-01 and contact-00/-01.
No change in the UI, still showing the door.png and contact.png.

I´m using Number because i had problems with Contact in my first runs.

But even when setting up this scenario with Contact and door-open/-closed i only get the standard door.png icon.


Hi Udo,

i did another test with Contact (Items), OPEN=geöffnet (windowcontact.map) and door-open/-closed.
It works …! :slight_smile:

The Web UI and iOS UI showing the correct icons.

Thanks for your help!




Contact itmTuer_Flur "Tür Flur [MAP(windowcontact.map):%s]" <door> (Flur) {homematic="address=MEQ0367606, channel=1, parameter=STATE"}

Contact itmFenster_Schlafzimmer "Fenster Schlafzimmer [MAP(windowcontact.map):%s]" <contact> (Schlafzimmer) {homematic="address=MEQ1726693, channel=1, parameter=STATE"}

Contact itmFenster_Badezimmer "Fenster Badezimmer [MAP(windowcontact.map):%s]" <contact> (Badezimmer) {homematic="address=MEQ1726970, channel=1, parameter=STATE"}

Contact itmFenster_Kueche "Fenster Küche [MAP(windowcontact.map):%s]" <contact> (Kueche) {homematic="address=MEQ1727000, channel=1, parameter=STATE"}




Frame label="Türen / Fenster" {
                     Text item=itmTuer_Flur
                     Text item=itmFenster_Schlafzimmer
                     Text item=itmFenster_Badezimmer
                     Text item=itmFenster_Kueche


web UI:

That’s very strange. Are you sure you referred to the correct icons? I can’t see the icon definition (maybe caused by community software - please use tripple backticks ` to quote code).

Edit: Ah. too late… :slight_smile:

I used the quote feature cause there is no code feature in the editor :smiley:
The triple backtick feature only works for half of the item definition as you can thee in my post.
Strange …

I like to come back to this post because I have a similar problem …

My mapping ist working fine in OH2 stable but my icons don’t. As you have written, the icons refer to the “original” state like closed / open instead of “geschlossen” or “geöffnet”.

So far so good… but it is really the right way to rename / duplicate the original icons?

In my case the SPS send open / close which is the opposite of the OH meaning. So I have to rename the closed window icon to window-open … confusing …

Any hints?


In OH2 there is an issue that some UI’s actually use the mapped value and not the raw item value. I haven’t had the time to create an issue in github yet


As far as i know, it’s not just UI that refers to a mapped value. I couldn’t make a group item (Group:Switch:OR) work if members of the group had mapping. So, I guess that everything refers to a mapped, rather then a raw state.

Best regards,

Indeed, I have that same problem in OH2. mapping contact states to “ON” and “OFF” rather than the “CLOSED” and “OPEN” and that immediately stops the dynamic icon. (all in my android phone app).

Well, seems I found a solution as we speak:
I had my map as
Which didnt work but
does work,
Created xxx-on xxx-off xxx-open and xxx-closed icons just to make sure