Integrating Garage Doors in OH with Google Home Assistant

Hi, I am running OH3.4.4 on a RPi4.

I have successfully created 2 items related to my Garage Door in OH3. The first is a Switch item to control the garage door motor, and the second is a Contact item to report the status of the magnetic reed switch on the garage door (contact closed = door closed, contact open = door open).

I have the Google Home Assistant action running and working fine to control lights and on/off plugs.

The switch and contact items for my garage door work great in OH3, however, I’m having problems integrating these 2 items with Google Home Assistant as a Garage door device.

My objective is to be able to say to Home Assistant:

  1. ‘Hey Google, is the Garage Door open/closed’, and it responds with either ‘The Garage Door is open/closed’ based on the status of the garage door Contact item in OH3.
  2. ‘Hey Google, open/close the Garage Door’, and it responds by activating the garage door Switch item in OH3.

The problem is that HA sees these 2 items as separate devices - i.e. there are 2 Garage Door devices in HA - even though they both have the same name.

My question is: how do I combine these 2 items into a single Garage Door device in HA so that when I ask ‘Hey Google, is the Garage Door open/closed’, it refers the current status of the Contact item in OH3, and when I say ‘Hey Google, close/open the Garage Door’, it activates the Switch item in OH3?

Here is the snippet from my .items file:

Switch      pGarageDoor_Opener    "Garage Door opener [%s]"   <switch>        (gGarage_Room)      {ga="Garage" [name="Garage door", roomHint="Garage", discreteOnly=true], channel="deconz:onofflight:raspbeebridge:garage-door-motor:switch", expire="1s,command=OFF"}
Contact     pGarageDoor_Status    "Garage Door is [%s]"       <garagedoor>    (gGarage_Room)      {ga="Garage" [name="Garage door", roomHint="Garage", queryOnly=true], channel="deconz:openclosesensor:raspbeebridge:garage-door-openclose-sensor:open"}

As stated above, these 2 items work great in OH3 - I can open/close the door if I click on the Switch item, and I can see the correct status of the door if I look at the Contact item in OH3. The issue is integrating both of these 2 items into a single Garage door device in HA.

Any help will be greatly appreciated.

See Google Assistant | openHAB

Unfortunately, Google Home doesn’t provide the sort of interface that works with the way you’ve models your garage door in OH. You’ll need to use a Rollersutter Item and probably some rules to take your two Items and update that Rollersutter Item appropriately.

Note that you should always look at the latest version of the docs for GA integration because the actual implementation is on the cloud server so the latest applies to all OH releases.

You can even connect a single item (e.g. rollershutter) to both channels, one for commands, the other for status. If you need some translation you can use an in- or outgoing profile. But still it won’t react exactly to the voice commands you asked for. In Alexa you can define static sentences for that purpose. I don’t know if that’s possible in Google home too.

Thanks @rlkoshak - I’ll look into using a single Rollershutter item in OH3 instead of a Switch and Contact items.

Thanks @Larsen - if I can get a dummy Rollershutter item working in OH3, then I’ll look into how to connect 2 different channels - 1 for the motor switch thing and 1 for the open/close sensor thing - to a single Rollershutter item. Otherwise, the fallback will be to create a rule to integrate the 2 items (Switch & Contact) into the Rollershutter item.

I think it’s a question of taste. I prefer not having many dummy items.
One thing to notice: In the UI openhab wants to protect you from connecting an existing item to a not matching channel and so only items with a matching type are selectable.
My workaround is to change the type of the item so that it matches (e.g. rollershutter to switch), then connect to the channel and then change back to the type I need. Sounds complicated, but it’s really just a few clicks.

What I really love are ecma profiles to change in-and outgoing data so that it matches your needs. You can directly enter a conversion like this in the field thing_to_item_transformation

|(input == "HIGH")? "ON":"OFF"

This is an example for a channel where the binding sends a string (HIGH/LOW) but I want a switch in openhab.

Thank for the pointer @rlkoshak - I was able to get this working by creating a dummy/proxy RollerShutter item, and using 2 simple DSL rules to:
a) post updates to the proxy RollerShutter item whenever the physical Contact item (reed switch) changes state; so the RollerShutter in GA always reflects the true state of the garage door, and
b) send an ON command to the physical Switch item (door motor) whenever the proxy RollerShutter item receives either an UP, DOWN, STOP or %closed command from GA.

Note, my garage door motor is controlled through a momentary contact switch (approx. 1.5 sec dur) - i.e. if the garage door is closed, pressing the switch will start to open it; if the garage door is opening, pressing the switch will stop it; if the garage door is open, pressing the switch will start to close it; if the garage door is closing, pressing the switch will stop it, etc.

For anyone interested, here are the .items I used:

// Garage Door physical motor
Switch      pGarageDoor_Motor       "Garage Door opener [%s]"   <switch>        (gGarage_Room)  ["Control"]     {channel="deconz:onofflight:raspbeebridge:garage-door-motor:switch", expire="1s,command=OFF"}
// Garage Door physical open/close sensor
Contact     pGarageDoor_Contact     "Garage Door is [%s]"       <garagedoor>    (gGarage_Room)  ["OpenState"]   {channel="deconz:openclosesensor:raspbeebridge:garage-door-openclose-sensor:open"}

// Garage Door proxy item
Rollershutter   vGarageDoor     "Garage Door [%s]"  <garagedoor>    (gGarage_Room)  ["Control", "Power"]  {ga="Garage" [name="Garage door", roomHint="Garage"]}

and here are the .rules I used:

rule "Control Garage Door"
when
    Item vGarageDoor received command
then
    if (receivedCommand == UP || receivedCommand == DOWN || receivedCommand == STOP) {
        pGarageDoor_Motor.sendCommand(ON)
        switch pGarageDoor_Contact.state {
            case OPEN : {
                vGarageDoor.postUpdate(0)
            }
            case CLOSED : {
                vGarageDoor.postUpdate(100)
            }
        }
        return;
    }
    if (receivedCommand instanceof PercentType && receivedCommand < 100) {
        pGarageDoor_Motor.sendCommand(ON)
        switch pGarageDoor_Contact.state {
            case OPEN : {
                vGarageDoor.postUpdate(0)
            }
            case CLOSED : {
                vGarageDoor.postUpdate(100)
            }
        }
        return;
    }
end

rule "Update Garage Door Status"
when
    Item pGarageDoor_Contact changed
then
    switch newState {
        case OPEN : {
            vGarageDoor.postUpdate(0)
        }
        case CLOSED : {
            vGarageDoor.postUpdate(100)
        }
    }
end

Yes, I could’ve combined the %closed IF clause with the UP, DOWN & STOP IF clause, but I am thinking that I might do something slightly different in the future if I ask GA to partly open the garage door.

@Larsen the dummy/proxy Rollershutter item approach that Rich suggested works perfectly, but I would like to know how I could simplify what I’ve done by having a single physical (not proxy) Rollershutter item and doing-away with the Switch and Contact items, and have the …garage-door-openclose-sensor:open channel determine the status of the Rollershutter item (either OPEN or CLOSED) and have the …garage-door-motor:switch channel control the operation of the Rollershutter item (either ON or OFF).

I realise that I might need to translate the GA commands (UP, DOWN & STOP) into a momentary ON command for the …garage-door-motor:switch channel.

well, I wrote above how to do that. just try it