Show state of a different item in labeltext

Tags: #<Tag:0x00007f2fb1474db0>

Hi,

I think I’ve seen something like that before, but couldn’t find anything in the wiki or forum, probably I am just searching the wrong expressions…

I have the following definition in a sitemap:
Switch item=KlimaNB_Mode label="Modus" mappings=[00=Auto, 01=Heat, 03=Cool, 09=Fan, 14=Dry]
which works fine so far. What I like is in the labeltext the actual setting, but the feedback of the setting is on another KNX-Address and therefore on another item.
So is it possible to get in the labeltext the actual readout of another item-state?

Thanks!

No, you cannot put the state of another Item into an Item’s label. There are a couple of workarounds though.

  1. Create a separate String Item and a rule to merge the states of your two Items as the state of this new Item.

  2. If the state is relatively simple you can use the visibility tag in the sitemap to only show the version that corresponds with the state of the other Item. For example, I use this for my garage door openers:

                Switch item=T_D_Garage1 label="Garage Door 1" icon="garagedoor-closed" mappings=[ON=Open] visibility=[N_D_GarageDoor1!="OPEN"]
                Switch item=T_D_Garage1 label="Garage Door 1" icon="garagedoor-open" mappings=[ON=Close] visibility=[N_D_GarageDoor1=="OPEN"]
                Switch item=T_D_Garage2 label="Garage Door 2" icon="garagedoor-closed" mappings=[ON=Open] visibility=[N_D_GarageDoor2!="OPEN"]
                Switch item=T_D_Garage2 label="Garage Door 2" icon="garagedoor-open" mappings=[ON=Close] visibility=[N_D_GarageDoor2=="OPEN"]

Hi Rich,

thank you very much for your reply!
I think the option with the separate string and rule was what I’ve read before, thank you very much!
I’ll try the second option, too, but I think in this case the first one is what I want.

Given that the feedback is the same data as the sent data, you could use both knx adresses at the same item plus setting autoupdate="false" to the item, so changes to the item will only happen when received from the knx binding:

Number KlimaNB_Mode "Modus [MAP(klima.map):%s]" {knx="GA1+<GA2", autoupdate="false"}

where GA1 is the “Set the Mode to” and GA2 is the “The Mode was set to” Group Address.
openHAB will read GA2 when starting up, the item will show the actual mode. If you switch the mode, openHAB will send the new mode to knx but the item will change it’s state only when openHAB received the answer from knx.

For displaying the Mode not only through pressed Buttons, you will also need a mapping file klima.map under transform/ folder, containing

0=Auto
1=Heat
3=Cool
9=Fan
14=Dry
uninitialized=-
-=-

Remember to eliminate the label setting in the sitemap.

Thank you for this option, I think that’s for this KNX-case it’s exactly what I need. unfortunately all my tests with this won’t show the expected result.
But eventually, as this installation was my first openhabinstallation, there may be some weird stuff going on as there are many things in it which shouldn’t and throw errors.
I think I’ll start over with this, as a “clean” configuration works perfectly (e.g. at my parents house, but there is only Z-Wave and no KNX).
I’ll get back here when I was successfull.