Combination of different relay and sensor

Hello,

I’ve got a garage door that I would like to control through openhab.

  • I’ve got a relay switch (push) that open or close the door. Each time you push the button, the port opens or closed, relative to his current state (nothing to do by openhab or so).
  • Beside, I’ve got a Garage Door Sensor to check the status of the port.

I would like now to have 1 line on the sitemap with following:

  • The icon (port) shows the status of the Garage Door Sensor
  • A push button to send a signal to the port

What’s the best way to do this?


For the moment, I’ve got in the items:

Contact Sensor09 “Werkplaats Poort [%s]” (AT_con,ALL_con) { zwave=“28:command=sensor_binary,sensor_type=10,respond_to_basic=true” }
Switch Relay03 “Atelier” { zwave=“27:1:command=SWITCH_BINARY,autoupdate=false” }

And in the sitemap:

Group item=BU_Poorten {
Switch item=Relay03 mappings=[ON=“Open/Dicht”]
Switch item=Relay04 mappings=[ON=“Open/Dicht”]
}

I think the only way to do this would be to have two rows in your sitemap, both for your open/close relay item with two different labels and icons, one for Open and one for Closed. Then have a Visibility tag for each so the Open row only shows when the door sensor is open and the Closed one when it is closed.

The visibility tag is something new to me. But sounds usefull to me.
I’ll have a look at it… (for the moment, I’ve got a small issue with the door sensors, I hope to resolve it in the next couple of days).

Thanks!

So your tip to use the visibility tag works! I’ve got for the moment following sitemap configuration:

Switch item=Relay03 mappings=[ON=“OPENEN”] icon=“garagedoor-closed” visibility=[Sensor10==“CLOSED”]
Switch item=Relay03 mappings=[ON=“SLUITEN”] icon=“garagedoor-open” visibility=[Sensor10==“OPEN”]

Maybe one small detail, is there a way to build in a kind of refresh? It would be nice if you could see change the port status when the sensor changes. I’ve tried with adding refresh=[5000] into the line, but this doesn’t do much.

The refresh tag will have no effect on the UI (I don’t think). That is a binding level setting. UI refreshing is a function of the UI being used. The mobile apps are pretty good at refreshing but sometimes the classic web UI can lag a bit.