Remotely opening and closing my garage

DezeStijn5 mins read

Intro

Coming home, I usually park my car in the garage. Sadly, I only have 1 remote left to open it, and it is usually left at home so I don’t lock people out while I’m away.

Having recently ordered some of the new Shelly Plus 1 Mini’s, I can easily integrate my garage door controller (dickert ACM20-03) into Home Assistant and use my phone to open/close the garage door.

You can use this for e.g., coming-home automations where the door automatically opens and/or closes when you arrive (and leave) home.

Wiring diagram

The controller has inputs for mains voltage, so we’ll power our Shelly by hooking it onto the 2nd pair of L/N terminals.

Looking at the user manual, we can see that we need to trigger an impulse between ports 25 and 26 to give the controller the signal to open or close the garage door.

Additionally, the controller allows you to wire a “garage door moving” (motor running) warning light between ports 15 (L) and 14 or another N connection. Luckily for us, this also outputs mains power, so we can use it as a switch (SW) input on our Shelly.

Wiring situation
Wiring situation

I’ve also wired in a physical button that is mounted on my indoor wall parallel to the Shelly. That’s why I have the “Chinese Wago” connected to my signal wires.
This switch has a 2nd connection between 26 and 28 to stop the gate. Usually you’d use this contact to wire a safety sensor, like a laser barrier, to ensure nobody gets crushed. Note that the gate does stop if it detects something’s blocking its movement.

Wiring diagram
Wiring diagram

Note that this diagram doesn’t include the wiring of the actual motor, the antenna for the physical remote, or the bridge between contacts X-Y to keep the N.C. stop contact closed.

Shelly config

We need to do a tiny bit of configuring on the Shelly.

For one, we don’t want the signal input from the “garage door moving” output to trigger the Shelly, stopping and/or reversing the gate again. We do this by setting the switch input to Detached mode.

Shelly switch set to Detached Mode
Detached Mode

Secondly, we need to mimick a press of a momentary button, not a toggle switch, without having to toggle the Shelly twice. To do this, we set an Auto-Off timer on the Output 1 for 1 second. Triggering the Shelly via the physical button on SW (configured as Momentary Switch), via the Shelly app or web interface, or via Home Assistation will always result in a 1s pulse, which is enough to trigger the garage door controller.

Shelly Auto Off timer set to 1 second
1s Auto Off

Home Assistant

Integrating the Shelly Plus Mini 1

Adding the UNI to Home Assistant is super easy.

First you’ll need to enable the Outbount Websocket on the Shelly. Once that’s enabled, Home Assistant should auto-detect your Shelly. If not, you can use the Shelly integration of Home Assistant to add the device.

Shelly Websocket config
Shelly Websocket

Coming home automation

The automation below will trigger when you arrive in the “home” zone and will send you an Actionable Notification. This does require you have the Home Assistant Companion App installed on your smartphone and you have a zone configured in Home Assistant.

I added a few comments to better explain certain sections in the code.

I also use a few Android-specific features like notification_icon and car_ui. Check the documentation for their iOS counterparts if you have an iPhone.

automation:
- id: 'ch_notify_opengarage'
  alias: Coming Home - Notification Garage Door
  description: Show notification when arriving home with the option to open the garage door
  mode: single
  trigger:
    - alias: Wait for sequr to arrive home
      platform: zone
      entity_id: person.sequr
      zone: zone.home
      event: enter
  # You could add conditions like time between xx:xx and yy:yy here
  # Or only trigger if zone.home == 1 (you're the only one home)
  condition: []
  action:
    # Set up unique action IDs so multiple automations don't conflict with eachother
    - alias: Set up variables for the actions
      variables:
        action_open: "{{ 'OPEN_' ~ context.id }}"
        action_cancel: "{{ 'CANCEL_' ~ context.id }}"
    - alias: Ask to open the garage door
      service: notify.mobile_app_smartphone
      data:
        title: "\U0001F3E0 Welcome home" # 🏠
        message: Open garage?
        data:
          # Show notification on Android Auto as well
          car_ui: true
          notification_icon: mdi:garage-open
          # Create unique notification channel
          # so we can change notification settings on phone
          channel: "Open garage"
          # Remove notification after 5 minutes
          timeout: 300
          actions:
            - title: "\U00002705 Open" # ✅
              action: "{{ action_open }}"
            - title: "\U0000274C Ignore" # ❌
              action: "{{ action_cancel }}"
    - alias: Wait for a response
      wait_for_trigger:
        - alias: Open
          platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: "{{ action_open }}"
        - alias: Close
          platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: "{{ action_cancel }}"
        - alias: Notification cleared
          platform: event
          event_type: mobile_app_notification_cleared
          # Make sure we capture the correct clearing event
          # By confirming the 1st option was our OPEN option
          event_data:
            action_1_key: "{{ action_open }}"
      timeout:
        hours: 0
        minutes: 15
        seconds: 0
        milliseconds: 0
      continue_on_timeout: false
    - alias: Perform the action
      choose:
        - conditions:
            - alias: Action is OPEN
              condition: template
              value_template: "{{ wait.trigger.event.data.action == action_open }}"
          sequence:
            - alias: Turn on Shelly
              service: switch.turn_on
              target:
                  entity_id: switch.garagedoor
        - conditions:
            - alias: Action is CANCEL or Cleared
              condition: template
              value_template: |-
                {{
                  wait.trigger.event.data.action == action_cancel
                  or wait.trigger.event.type == "mobile_app_notification_cleared"
                }}                
          sequence:
            - stop: Cancelled

And just like that, you’ll get a notification on your phone (and Android Auto if connected) as soon as you arrive home. You may need to drag down on the notification to make the action buttons visible. Pressing “Open” will trigger the garage door controller, while swiping the notification away or pressing “Ignore” will have no noticeable effect.

If you have a garage door that’s integrated in HA as a cover, meaning you have more visibility in the actual state of the door (opened, closed, etc.), you could of course add more logic. Like having the “Open” action actually only open the door instead of triggering a “toggle” like in my situation.
By adding some reed sensors to the gate, I could probably achieve this using a cover.template. Perhaps I’ll do that in the future. And if I do so, I’ll definitely write a blog post about it.