Want a Switch item to display a Contact status

my garage has a button that simply opens, stops or closes my garage door. to check if the door is open or closed I`ve a sensor that closes when the door is closed. In the BasicUI I have two items:
grafik
I use a proxy with rules to translate the switch into a contact.

items:
Switch FibUN1_IN1 {channel=“zwave:device:4dfe5541:node15:sensor_binary1”}
Contact GaragentorrechtsProxy “Garage rechts [MAP(garage.map):%s]”

sitemap:
Switch item=Garage_rechts mappings=[ON=“Taster”]
Text item=GaragentorrechtsProxy

Is there a chance that the “Garagentor rechts” switch displays the status of the Sensor “Garage rechts”. I`d like to have only one line in the GUI, instead of two. “Taster” should display the value of the Sensor.
thx

Use the visibility tag on the sitemap to show a Switch with a custom label and icon when it is open and another when it is closed.

You been drinking Rich?

Yes actually. Yes gads auto correct mangled that post. Clearly I’m not very good at actually reading what I posted.

5 Likes

may you help me please once more

sitemap:
Switch item=Garage_links visibility=[GaragentorlinksProxy == “offen”, GaragentorlinksProxy == “zu”]
does not work at all, the switch is not seen in basicUI.

here my items:
Switch Garage_links “Garagentor links[]” (Garage) {channel=“zwave:device:4dfe2711:node10:switch_binary1”} //thats the switch that actually opens or closes the door
Switch FibUN1_IN1 {channel=“zwave:device:4dfe2711:node15:sensor_binary1”} //thats the sensor that tells if door is opened or closed
Contact GaragentorlinksProxy “Garage links [MAP(garage.map):%s]” //thats the proxyitem that displays the door status as contact instead of switch

garage.map
CLOSED=zu
OPEN=offen
NULL=undefiniert
-=nix

thanks

You have to use the actual state of the item in visibility, not the mapped value.

Switch item=Garage_links visibility=[GaragentorlinksProxy == OPEN, GaragentorlinksProxy == CLOSED]

I dont get that working... playing around with the visiblity is either not working or showing nothing. I also tried to combine the mapping with visibility command without success. Im wondering if this is possible at all…
I need to put Switch item Garage_links on my sitemap because this switch (its actually acting as button) rolls up or down the garagedoor. When the garagedoor is closed another Switch item (FibUN1_IN1) changes to CLOSED. now I would like the GUI to display something like this:
grafik
any idea?


Switch item=aGarageOpener1 icon="garagedoorclosed" mappings=[ON=Open]  visibility=[vGarageOpener1 == CLOSED]
                Switch item=aGarageOpener1 icon="garagedooropen"   mappings=[ON=Close] visibility=[vGarageOpener1 == OPEN]
1 Like

thanks Rich, that works.

the icons garagedoorclosed and open do not properly show. (shown as door half-way open). I did a workaround and created garage_open.svg and garage_closed.svg and put it in the icons directory…
I was not able to find the svg files in any openhab directory, so I just downloaded the picture from the GUI…

1 Like

Does this solution still work for OH2.5 (2.5.2-1)?

I tried and the icon is not closed or opened according to the status, it is always garagedoor-ajar, regardless of status :frowning:

Yes, it works.
If you have a problem you should share your Item and sitemap details, and what icon files you have.