Open Sesame: Garage Door Automation with HomeKit

The only home automation feature my wife cares about is the garage door opening magically when she gets home from work. I find that iCloud’s location tracking is quite reliable, so I use the automation functionality of the iOS Home app to trigger opening the door.

I was jazzed to see that I could set the garage’s device_class as garage, mainly because this causes the GUIs of both HomeAssistant and Apple’s Home app to display intuitive state icons. However, once the Home app recognizes the entity as a garage, it does not allow it to be opened automatically by an automation, instead requiring a user confirmation to be entered on an unlocked iOS device.

Geeky security sidebar: This is actually quite clever on Apple’s part. By requiring the device to be unlocked, they are enforcing two-factor authentication for this action. This means that physically possessing the device (something you have) is not enough, you also have to be able to unlock the device using either the passcode (something you know), or TouchID / FaceID (something you are).

To get around this limitation, I created a simple script to call the cover.open_cover service, which the Home app sees as a switch via the Homekit component. I then I used this switch in the Home app automation, in place of the actual garage door entity.

Here’s the relevant code bits and some screen captures from the Home app, if anyone else comes across a similar issue.

configuration.yaml

homekit:
  filter:
    include_entities:
      - cover.garage
      - script.garage_trigger

customize.yaml

    cover.garage:
      device_class: garage

scripts.yaml

  garage_trigger:
    alias: Garage Trigger
    sequence:
      - service: cover.open_cover
        entity_id: cover.garage

1 Like

Hello,

I’m just moving across from running old Homeassistant and Hombridge now HA has Homekit.

My garage door is controlled via a Wemo Maker and via HomeAssistant with Homekit I see this in my iOS Home app but as a Switch. When I was using Homebridge it appeared as a Garage Door with the correct icon as shown above, plus I got Home app notifications on open/close as the Wemo maker also has a sensor hooked up.

Anyway, I guess the issues is why is HA and Homkit showing it as a switch not a Garage Door. I tried adding the below and re-adding my Homkit items but its still a Switch (or Fan or Light), no Garage Door option, any ideas?

homekit:
      filter:
        include_entities:
          - cover.garage

    customize.yaml

        cover.garage:
          device_class: garage

Does the Wemo Maker show up in HA as a switch or a cover? And if it’s a cover, does it support open and close as described in the HomeKit component’s supported components table?

One workaround that I thought of would be to have HA treat the Wemo Maker as a switch, and to use the Template Cover component to expose it to HomeKit as a cover. There’s an example on that page that might help.

Let me know what you think.

Hello,

HA sees the Wemo Maker as a switch.

Thanks for the cover link. I’ve tried the cover route but now homekit shows it with the blinds icon.

This is what I added:
cover:

  • platform: template
    covers:
    garage_door:
    friendly_name: “Garage Door”
    position_template: “{{ states(‘sensor.garage_door’) }}”
    open_cover:
    service: switch.turn_on
    data:
    entity_id: switch.garage_door
    close_cover:
    service: switch.turn_off
    data:
    entity_id: switch.garage_door
    stop_cover:
    service: switch.turn_on
    data:
    entity_id: switch.garage_door
    icon_template: >-
    {% if states(‘sensor.garage_door’)|float > 0 %}
    mdi:garage-open
    {% else %}
    mdi:garage
    {% endif %}

Try this on your customise.yaml

Garage Door Dynamic Icon

cover.namexx:
device_class: garage

Exactly, if it’s showing a blind I’d say you’re 95% there. If you set the device_class of the cover to garage you should be all set. Let us know how it goes.

I can now see the icon as a garage door but it now fails to open/close the door. When I click it nothing happens

Wishing I had not ditched homebridge as that all worked great.

Did it work when it was showing up as a blind?

Yes it was working, but was a slider

Hello !!

I need some help !!!

I live in an Apartment, and my Garage opens with the remote, and closes automatically after 2 minutes !!

I would like to open it with Broadlink and add it to homekit !
I already tested with broad link command, and it works from my apartment!!! I can open it!
But now I want to integrate with HA and then Homekit !!

I want to open it and set a timer to automatically close !!
Can someone help me with the code?

here is what I have so far

switch:
  - platform: broadlink
    host: 192.168.1.113
    mac: '42:9f:77:18:18:b9'
    switches:
      garage:
        friendly_name: Garage
        command_on: 'sgGEAwwmC58YDCUlDA0lDSQmDCUMJgwNJCYMJQwmDCUMDSUMJQ0kDSUNJCYMDSQNJQ0lJQwMJSYLJgwmCyYMJQwmDA0kDSUlDCYMDCUmDCUMJgwMJSUMDSUNJCYMDCUmDCUMDSQmDCYLDSUNJCYMJQwNJSUMAAMbGA0lJQwNJQwlJQwmDCUNDCUlDCYMJQwmCw0lDSUMJQ0kDSUlDA0lDSQNJSUMDSUlDCYMJQwmCyYMJgsNJQ0kJgwmCw0lJQwmDCUMDSQmDA0kDSUmCw0lJQ0lCw4kJgwlDA0lDCUlDCYMDsdsdCUmDAADGhkNJCYLDSUNJCYMJgsmDA0kJgwlDCYLJgwNJQwlDSQNJQ0kJgwNJA0lDSQmDAwlJgwlDCYLJgwlDSUMDSQNJSYLJgwNJCYLJgwmDA0kJgsOJA0kJgwNJCYMJQwNJCYMJgsNJQ0kJgwlDA0lJQwAAxsYDSQmDA0kDSUlDCYMJQwNJSUMJQ0lDCYMDCUNJA0lDSQNJSYLDSUMJQ0lJQwNJSUMJQ0lDCUMJgwlDA0lDCUmDCUMDSUlDCYMJQwNJCYMDSQNJSUMDSUlDCYMDCUmCyYMDSUMJSUMJgwNJCYMAAMaGQwlJgsNJQ0kJgwlDCYLDiQmDCUMJQwmDA0kDSUNJA0lDSQmDAwlDSQNJSYMDCUlDCYMJQwmDCYLJgwNJA0lJQwlDQwlJQ0lDCYLDSUlDA0lDSQmDAwlJgsmDA0kJgwlDA0lDSQmDCUMDSUlDAADGxgNJCYMDSQNJSUMJgwlDA0kJgwmCyYMJQwNJQwlDSQOJA0kJgwNJQwlDSQmDA0kJgwlDCYMJQwmDCUMDSQNJSYLJgwNJCYMJQwmDA0kJgwMJQ0kJgwNJSUMJQwNJSUMJgwNJA0lJQwmDAwlJQ0AAxoYDSUlDA0lDCUlDSUMJgsNJSUNJQwlDCYMDCUNJA0lDSQNJSYMDCUNJA0lJQwNJSUMJgwlDsdsCYMJQwlDQwlDSQmDCYLDSUlDCYMJQwNJSUMDSUMJSUMDSUlDCYMDCUmDCUMDSUMJSUNJQwsdsdsNJCYMAAMbGA0kJgwMJQ0kJgwlDSUMDSQmDCUMJgwlDA0kDSUNJQwlDSQmDA0kDSUNJCYMDSQmDCUMJgwlDCYMJQwNJA0lJQwmDA0kJgwlDCYLDSUmDAwlDSQmDA0kJgwlDA0kJgwmCw0lDSUlDCYLDSUlDAAF3AAAAAA'

Interesting workaround.:grinning: I’ll be trying something like this as well.
Are you able to open the garage door via Siri even when the phone is locked, or do you need to ask Siri to “turn on Garage Trigger” ?

The second, “Turn on garage trigger”. However, I almost never do that and just use “Open/close the garage door.”, unlocking my phone if I need to. The trigger switch works great for the HomeKit automation though.

I’m still trying to find a reliable method to open the garage door and disarm the alarm as I approach the house. So far I’ve been unsuccessful getting the scripts for the garage door, I have two, big and small, and the alarm to appear in Homekit. Here’s the code:

config.yaml:

homekit:
  filter:
    include_domains:
      - alarm_control_panel
      - script.alarm_trigger
      - input_boolean
      - cover.big_door
      - script.garage_trigger
  entity_config:
    alarm_control_panel.alarm:
      code: !secret alarm_code

scripts.yaml:

  garage_trigger:
    alias: Garage Trigger
    sequence:
      - service: cover.open_cover
        entity_id: cover.big_door
  alarm_trigger:
    alias: Alarm Trigger
    sequence:
      - service: alarm_control_panel.alarm_disarm
        entity_id: alarm_control_panel.alarm

customize.yaml:

cover.big_door:
 device_class: garage

cover.small_door:
 device_class: garage

Running Hassio V85.0 on RPI3b+. Configuration check reports OK. Garage doors and alarm are responsive in Homekit.

In your Homekit config, I think you should have include_entities instead of include_domains. Otherwise, it looks right to me.

Yes. Changed to entity ids. Now have the switches in Homekit.

homekit:
  filter:
    include_entities:
      - alarm_control_panel.alarm
      - script.alarm_trigger_disarm
      - script.alarm_trigger_arm
      - input_boolean.gak_present
      - input_boolean.ssk_present
      - script.garage_trigger
  entity_config:
    alarm_control_panel.alarm:
      code: !secret alarm_code

I’ll report back if this works for me.

UPDATE: garage_trigger used in an Apple Home automation opens the door without the unlock requirement. Unfortunately, when used in an arrive home automation, the door opens when i leave and when I return. Anyone run into this?

All these months on I still can’t this to work.

Garage door still shows as blinds.

I noticed some variation in entity naming earlier in the discussion. Is the name cover.garage_door used consistently in all code references? I’m on myq, so can’t be of much help.

Hey folks, sorry for reviving an old topic, but I think I may have found the solution to this. (Maybe this will help other people that find this thread…)

I got it to work in HomeKit and the Home app by adding the garage door as a cover in my config.yaml and then customizing it by setting the device_class: garage, as stated above. However, I was still getting the blind icon in the iOS Home app, and it would not open or close the door.

I was able to fix it by resetting the accessories. You can do this by calling homekit.reset_accessory and supplying the entity ID. Easiest way to do this is by using the Services tab in the Home Assistant developer tools.

This appears to reset the HomeKit cache and fix the garage door! Now the icon correctly shows my door, the state is correct, and I can raise/close the door as expected.

3 Likes

Had the same problem. Worked for me, thanks!