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.
Item:
Number itmTuer_Flur "Tür Flur [MAP(windowcontact.map):%s]" <door> (Flur) {homematic="address=MEQ0367606, channel=1, parameter=STATE"}
Sitemap:
Text item=itmTuer_Flur
windowcontact.map:
0=geschlossen /* closed on german */
1=ge\u00f6ffnet /* open on german */
-=unbekannt
I tried the following names:
contact-1.png
contact-open.png (renamed the windowcontact.map for this try)
contact-true.png
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.
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.
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.
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).
I used the quote feature cause there is no code feature in the editor
The triple backtick feature only works for half of the item definition as you can thee in my post.
Strange …
Hallo!
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 …
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.
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
CLOSED=ON
OPEN=OFF
NULL=onbekend
Which didnt work but
CLOSED=on
OPEN=off
NULL=onbekend
does work,
Created xxx-on xxx-off xxx-open and xxx-closed icons just to make sure