HABpanel - 2 channels in 1 widget?

I started playing a little with HABpanel. As my design is now, I have a push button to trigger my garage door to open and close, respectively. Below I have a ‘dummy’ showing the status of a switch that shows if the garage door is open or closed. There are 2 different resource IDs, one to trigger the actual open / close feature and another to display the status.
My question now is whether I can somehow integrate the pushbutton into the same icon that shows the status of the garage door to avoid having the green switch icon above. So I just press the icon that shows the status of the garage door, which sends the ON command that the green pushbutton does now ?

1 Like

Yes, you can do this.
Can you post the 2 relevant Item configs?

I’m on the phone right now, but I have following:

Switch Garage_Door “Port” (channel=xxxxx)
This is the pushbutton

Switch Garage_Magnet “Magnet Port” (channel=yyyyyy)

The reason i use “switch” for the magnet contact, is that my IHC controller is defining it so (ON command when closed, OFF command when open) that is also why i created my own icon for the garagedoor, defining a “garage-on” “garage-off” and “garage” icon in the classic folder.

Hi Dim!

Here is the two items. First - the button, second - the state (is the door open or closed)

Switch   Garage_PortOpNed          "Port"                                          <garagedoor-50>              {channel="ihc:controller:74ee5efb:input25558106"}
Switch   AlarmGar_Totalalarm       "Status Totalalarm Garage [MAP(alstat.map):%s]" <al>                         {channel="ihc:controller:74ee5efb:output16736859"}

Ok… One (simple) way to solve this (to have one Widget controlling 1 Item that sends the Commands to the Garage Door and reads the status from the Magnet contact) is to use an intermediate dummy Item and a rule:

Switch Garage_Control "Garage Control" <garagedoor>
rule "Garage_Control_Rule" // One Item to control Garage Door Motor and read Contact status
	Item Garage_Control received command

I started to write the rule and then I realized 2 things:
a) There is already an example here: How to make garage door control - only one button but two directions?
b) What about using a Group… it should work:

Group:Switch:AND(ON,OFF) gGarage

add the 2 existing Items to the group and use the Group name in your HABpanel widget…
If I am not wrong, it will work like this:

When you toggle ON the Group Switch, it will send ON to both Items. The Garage_PortOpNed will process ON and open the Garage Gate while the AlarmGar_Totalalarm will process ON but will not change the actual state of the magnet contact so the next time it gets updated, it will read from the binding.

Careful not to trigger your Alarm system if you send ON to your AlarmGar_Totalalarm Item :slight_smile: It depends how your alarm is integrated with OH2.

The status of the Group will be ON if both members of the Group will be ON and OFF if either one or both OFF.

Ps: This Group story is similar to having only 1 Item bound to both IHC channels but this may not work due to the MAP xformation needed.

But the switch is a push button, so it will not stay on. And i really don’t want to send ON commands to my magnet, as i prefer only to read from this. It’s just created as a switch, because IHC defines it ON/OFF instead of OPEN/CLOSED.

What i need is a possibility to get the state from the magnet, to control the icon on the widget, and when i press the widget i want to send a ON command to the door opener. I don’t need timers and stuff like that to “control” the door opener, IHC is already doing this.
OpenHab is just used as a “remote control”, i keep all the functions in the IHC controller - as i want to be able to use it without being dependent on OH.

which switch are you referring to?

Ok… but… what could happen if you send “ON” to it from OH2?

You can also use a Contact Item and a map transformation if you want but that’s not important.

sending an ON Command from OH2 to IHC is a form of control.

You will need an intermediate Item to be displayed on your HABPanel if you want to “unify” the command and status information.

This is what the example that I linked does. nothing more.

The switch that sends the ON command to IHC, and get the garage door moving.

It is not possible to make ONE widget, and define ONE item to the “push function” and define another item to the “icon state”?

doubt it… not sure… I haven’t seen anyone implement this before

Okay. Well it isn’t that much of a problem, as it works fine now. It wold just be cool, to get rid of the button widget - and get the possibility to press the widget, that display the door :slight_smile: