Garagedoor opener in Homekit

Hi everyone,

I’m trying to figure out how to configure my garagedoor opener correct for homekit.

I have an electric garagedoor with a single button to open, close and stop de door movement. This button is directly connected to the garagedoor unit

I have a shelly one connected in parralel to this button. When I Press the switch for this, it turns on for 1 second and then back to off, this way it simulates the button press.
Besides the button, I have a reed sensor connected on the bottom of the garagedoor to detect if the door is closed.

In openhab they are configured the same way:
1 Relay item, to open and close the door
1 Input item, to show the status (OPEN, CLOSED)

I now have these 2 items as 2 items in homekit (A door sensor and a swich)
But I know that there is a GarageDoorOpener object for the homekit plugin, but I dont know how to connect the ObstructionStatus, CurrentDoorState, TargetDoorState to the Relay and Input item.

Which metadata object should I connect to which homekit item? or do I need additional hardware to make this work?

Hopefully someone can help with this. Thanks in advantage :slight_smile:

i have very similar setup but with homematic instead of shelly.
here is my configurations:

String    garageDoorStatus     "Garagentor Status [%s]"  <door>  (gGarageDoor)      {homekit="ContactSensor", channel="homematic:HMIP-SWDO:rasmatic:0000:1#STATE"}
Switch    garageSwitch  "Garagetor"    {channel="homematic:HmIP-WGC:rasmatic:001:3#STATE"}

Group           gGarage           "Garage"                                      {homekit="GarageDoorOpener"}
Switch          garageObstruction "Garage Obstruction"          (gGarage)       {homekit="ObstructionStatus"}
String          garageCurrentState "Garage Current State [%s]"  (gGarage)       {homekit="CurrentDoorState"}
String          garageTargetState "Garage Target State [%s]"    (gGarage)       {homekit="TargetDoorState", alexa="ModeController.mode" [category="EXTERIOR_BLIND", supportedModes="Closed=@Value.Close, Open=@Value.Open",actionMappings="Close=Closed,Open=Open", friendlyNames="Garage", language="de"]}


rule "garage door state update"
     Item garageDoorStatus received update
     if (garageDoorStatus.state == "OPEN" ) {
     } else {

rule "garage door target state"
     Item garageTargetState received command

I’ve tried to fix it with your data, but I haven’t been completely solved it. I was wondering, in your configuration you have two groups:

Your garageDoorStatus is connected to the group gGarageDoor
and all your other items are connected to the group gGarage

And only the gGarage has the homekit tag GarageDoorOpener and the gGarageDoor isn’t shown in your configuration.

At my configuration the garagedoor only pops up in homekit when I connect the garageDoorStatus to the gGarage instead of .gGarageDoor. Am I doing something wrong here or should I connect it to gGarage?

you dont need to have gGarageDoor group. it is basically a group for contact sensor i want to add “battery status” to it, therefore the group

1 Like

Ah good to know, I Found out that the reason something isn’t working is because the if statement in the rule isn’t resolved correct. When lookin at the logs I see the following:

2020-10-12 12:14:45.759 [vent.ItemStateChangedEvent] - ShellyGarageDeurInput changed from CLOSED to OPEN
2020-10-12 12:14:45.762 [ERROR] [lipse.smarthome.model.script.LogTest] - Input Update
2020-10-12 12:14:45.770 [ERROR] [lipse.smarthome.model.script.LogTest] - INPUT CLOSED

When my rule is like this:

rule "garage door state update"
     Item ShellyGarageDeurInput received update
     logError("LogTest", "Input Update")
     if (ShellyGarageDeurInput.state == "OPEN" ) {
        logError("LogTest", "INPUT OPEN")

     } else {
        logError("LogTest", "INPUT CLOSED")


For some reason it doesn’t accept the if statement to be true:
if (ShellyGarageDeurInput.state == "OPEN" )
I also tried:
if (ShellyGarageDeurInput.state.equals("OPEN"))
But that didn’t change the behaviour

Fixed it by changing the rule to:
if (ShellyGarageDeurInput.state.toString() == 'OPEN' )

Thanks for the help @yfre

1 Like

thanks for this thread.
The problem I stumbled upon was different, but it is solved in your rule @yfre:

When I opened the garage door manually (by remote control or simple wired switch) the CURRENT_DOOR_STATE did change. But my rule did not alter the TARGET_DOOR_STATE, so HomeKit got confused because that states did not match. The Home app displayed “closing” or “opening”.

So please always make sure that the target state follows the current state, like it is done in @yfre’s rule. Use an “postUpdate()” so that the state is updated but no command executed. Use “received command” in the rule that triggers the motion.

Seems very obvious, but this might help anyone else.


Sorry but I need some help here. I have also a Shelly One in place to control my garage door.
Everything is working fine so that there is one button for controlling UP, STOP, DOWN, STOP and a String where the current status is stored.

I have added the homekit items so that the Garage appears in my Home App. If I control my Garage Door via OH the Homekit App is updated correctly.
The issue I have currently is, that when I try to open/close the garage door from the Homekit app nothing happens. It looks that this homekit switch is doing nothing.

I thought that the Switch „garageObstruction“ is doing this stuff and have linked in to my Shelly in PaperUI, too but this changed nothing.

Any hint?

garageObstruction tells whether the garage door is blocked by something.
for open/close you should use TargetDoorState and CurrentDoorState

if it is still not working please share your metadata configuration

Thanks for the reply. I have troubleshoot a little bit further with the event logs. If the homekit switch was set the TargetDoorState is changed.

Now I understood how this is working in general. Then the problem was that my shelly can only turned on. It will turn off after 1 sec automatically. So I have to change the rules a little bit morgen but now it is working.
I can control the garage door still in my OH environment and also via Homekit and carplay directly from inside my car. Thanks

1 Like