Garagedoor opener in Homekit

Tags: #<Tag:0x00007efed8466b98> #<Tag:0x00007efed8466990>

Hi everyone,

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

Garagedoor:
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:
items

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"]}

rules

rule "garage door state update"
when
     Item garageDoorStatus received update
then
     if (garageDoorStatus.state == "OPEN" ) {
        garageCurrentState.sendCommand("OPEN")
        garageTargetState.postUpdate("OPEN")
     } else {
         garageCurrentState.sendCommand("CLOSED")
        garageTargetState.postUpdate("CLOSED")
     }
    garageSwitch.sendCommand(OFF)
end

rule "garage door target state"
when
     Item garageTargetState received command
then
    garageSwitch.sendCommand(ON)
    garageSwitch.sendCommand(OFF)
end
1 Like

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"
when
     Item ShellyGarageDeurInput received update
then
     logError("LogTest", "Input Update")
     if (ShellyGarageDeurInput.state == "OPEN" ) {
        logError("LogTest", "INPUT OPEN")

        garageCurrentState.sendCommand("OPEN")
        garageTargetState.postUpdate("OPEN")
     } else {
        logError("LogTest", "INPUT CLOSED")

        garageCurrentState.sendCommand("CLOSED")
        garageTargetState.postUpdate("CLOSED")
     }
    ShellyGarageDeurRelay.sendCommand(OFF)
end

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

Hi,
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.