KNX-HomeKit-CarPlay-Garage Door Opener

Hello.

Does anybody know how to configure a thing to get the garage door opener icon on Apple CarPlay?

Hi Georg,

not sure at which stage you are. Do you have garage door opener already connected via KNX with openHAB? Do you have Garage Door Opener accessory already in your home app on your iphone/ipad?

Hey eugen.

I had one switch for open and close the grage door in openhab and HomeKit, so far. Now i changed the knx wiring to have a switch for open and another for close. I have not setup this two switches in openhab. I will do this in the next few weeks. When i have an open and an close switch in openhab then i have to think about how to map them to HomeKit. The question is how to map them to HomeKit to see a garage door opener in the HomeKit App and the garage door icon in car play. I have to figure out, how to configure the HomeKit item in openhab, so that the HomeKit show it as a garage door opener and carPlay shows the button. I even don‘t know if this is possible.

Hi Georg,

sure, it is possible.
the solution with one switch would be easier than with 2 switches but it is possible with 2 as well. questions

  • how you configure your switches/items? using paperUI or using text file?
  • do you have homekit binding already installed (you can do it via paperUI)

Hey Eugen,

i changed from one to two switches, because of having up and diwn directions. So if i am ready i can tell siri to open the garage door or close the garage door.
I am doing everything by text file. I am still running a couple of items and have them allready in HomeKit (e.g Rollershutters, Switches, window sensors).

Hi Eugen,

i am sitting now infront of my openhab configuration.
As I said I have two knx adresses: one for garage door up (2/0/2) and one for down (2/0/3)

if have added the following to my knx.things configuration:

/*Garagentor*/
    Thing device Schaltaktor_Garagentor [
        address="1.1.6",
        fetch=true,
        pingInterval=300,
        readInterval=3600
    ] {
    Type switch         : garagentorAuf    "Garagentor Auf"            [ga="2/0/2"]
    Type switch         : garagentorZu     "Garagentor Zu"             [ga="2/0/3"]
    }

And to my knx.items file I added this:

Switch          garagentorAuf      "Garagentor Auf"                            <garagedoor>    (KG_Garage)     ["Switchable"]          { channel="knx:device:bridge:Schaltaktor_Garagentor:garagentorAuf", autoupdate="false" }
Switch          garagentorZu      "Garagentor Zu"                            <garagedoor>    (KG_Garage)     ["Switchable"]          { channel="knx:device:bridge:Schaltaktor_Garagentor:garagentorZu", autoupdate="false" }

How can I set this up to get the Garage Door Opener for CarPlay?

It is bad, that there is no example in the documentation for the garage door opener. :pensive:

Hi Georg,

you are right. the example is missing in the documentation.
here is my configuration of garage opener

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

the items above are all virtual items. then i have two items that is mapped to homematic garage opener device and to open/close sensor.

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

and the rules which maps the real devices to virtual items

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

maybe rules can be optimised but they are working for me.

and once it is defined as homekit garage opener accessory it will also appear in carplay.

Thank you eugen for your code. As I see (and you also wrote) you have one switch but I have now Up and Down. The behaviour is like this: If you press UP the door opens and if you press any switch again the door stops.
I will try to implement your code but I am not sure doing this for UP/DOWN-Switches.
The Alexa stuff can be deleted, can it?

alexa="ModeController.mode" [category="EXTERIOR_BLIND", supportedModes="Closed=@Value.Close, Open=@Value.Open",actionMappings="Close=Closed,Open=Open", friendlyNames="Garage", language="de"]

Oh you have language=“de”. Are you speaking German? I am from Austria. :wink:

i have only one switch for garage opener which react on event like this “Open-Stop-Close-Stop”

alexa stuff can be removed.

do you have a sensor or other way to derive the current status of the door, e.g. close/open?
at the end you need to provide the current and target states.

e.g. if “UP” switch is activated you would set the target state to “OPEN”, if “DOWN” is activated then to “CLOSED”.

I have now implemented this in my items file but the garagedooropener is not shown in my HomeKit app.

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

hm. if you just added these lines you should already see garage door in home app. if it does not appear:

  • try to restart openHAB and home app
  • try to update homekit integration in openHAB (not sure in which version garage door opener was added)

I did a restart already and also reset the HomeKit bindings (sin openhab console)
I have Homekit 2.5.3 integration, I think this is an actual one.

ok. 2.5.3 is a pretty old one. the latest one is 2.5.7
check this post for update instructions

Can u tell me, what I have to provide for “id of homekit binding” in the update command?

Edit Ok I got it by using “list” command

Ok, now I see the garage door opener in the homekit app. I have to check now if my modified rule is working.

It seems I have a logic issue in my rules.

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

rule "garage door target state"
when
     Item garageTargetState received command
then
        if (garageTargetState.state == "OPEN") {
                garageCurrentState.sendCommand("OPEN")
                garagentorAuf.sendCommand(ON)
                garagentorZu.postUpdate(OFF)
        } else if (garageTargetState.state == "CLOSED") {
                garageCurrentState.sendCommand("CLOSED")
                garagentorZu.sendCommand(ON)
                garagentorAuf.postUpdate(OFF)
        }
end

lets first focus on garageTargetState rule. this rule gets triggered when you change garage door target state in home app, e.g. click on “close door”

important is to know the difference between sendCommand and postUpdate.

  • sendCommand sends update to the actual device (via binding)
  • postUpdate change the status in openHAB (e.g. in paperUI) without sending the command to the actually device.

means, in your case you should use sendCommand for garagentorAuf/garagentorZu.
e.g.
garagentorAuf.sendCommand(ON)
garagentorZu.sendCommand(OFF)

the next is to check whether garagentorAuf/garagentorZu are working independent of homekit. what happens if you change the values via paper UI?

I am not at home now. When i am back i am going to check the rules again.
I guess i have to rethink my rules. Also i am using a real contact sensor for the state of the door. This i a knx contact which sends contact close when door is completely closed and open when door is not in closed state.

Do you also have a real contact on your door?

garagentorAuf / garagentorZu Items are working. I have them visible in Homekit and Openhab Ui.

In garageTargetState rule i am sending the command to the items. The postUpdate command is to set the visible state in the Ui (Homekit ui and openhab ui).
This is because openhab does not have push buttons.