Smart Garage Door Automation with Shelly and Custom Scripts

Hey everyone, I wanted to share my recent success in setting up a smart garage door automation system using a Shelly 2.5 and some custom scripting. It’s been a fantastic project that combines hardware integration with Home Assistant’s flexibility.

The Setup
I have a Hörmann Promatic2 sectional door, and I wanted to automate it without replacing the existing hardware. After some research, I decided to use a Shelly 2.5 in relay mode. The setup involves wiring the Shelly to the garage door’s existing control system and adding a reed contact for monitoring the door’s state.

Hardware Needed

  • Shelly 2.5 (I recommend the newer 2PM model)
  • Reed contact (I used the ABUS MK2000W - NC)
  • Some basic wiring components

Shelly Configuration
I configured the Shelly in relay mode with two channels. Both channels were set to auto-OFF with a 1-second delay. The switch type was set to ‘detached’ to avoid any unintended behavior.

Home Assistant Integration
To monitor the door’s state, I used two binary sensors created by the Shelly. These sensors detect when the door is opening, closing, open, or closed. I also set up a custom script to update the door’s status in real-time.

The Automation Script
Here’s a simplified version of the script I used:
yaml

  • trigger:
    • platform: state
      entity_id:
      • binary_sensor.garage1_1_input
      • binary_sensor.garage1_2_input
    • name: Garage_Status
      unique_id: Garage_status
      state: |
      {% if (trigger.to_state.state == ‘on’ and trigger.entity_id == ‘binary_sensor.garage1_1_input’) %}
      closed
      {% elif (trigger.to_state.state == ‘off’ and trigger.from_state.state == ‘on’ and trigger.entity_id == ‘binary_sensor.garage1_1_input’) %}
      opening
      {% elif (trigger.to_state.state == ‘off’ and trigger.entity_id == ‘binary_sensor.garage1_2_input’) %}
      open
      {% elif (trigger.to_state.state == ‘on’ and trigger.from_state.state == ‘off’ and trigger.entity_id == ‘binary_sensor.garage1_2_input’) %}
      closing
      {% endif %}

Button Card Integration
For a user-friendly interface, I created a custom button card that shows the door’s current state with different colors and icons. Here’s the configuration:
yaml

  • type: custom:button-card
    color_type: card
    action_name: run
    tap_action:
    action: call-service
    service: switch.turn_on
    service_data:
    entity_id: switch.garage1_1
    name: Garagedoor
    show_state: false
    show_label: true
    state:
    • value: open
      label: DOOR OPEN
      color: red
      icon: mdi:garage-open-variant
    • value: opening
      label: DOOR IS OPENING
      color: orange
      icon: mdi:arrow-up-bold-box
    • value: closing
      label: DOOR IS CLOSING
      color: orange
      icon: mdi:arrow-down-bold-box
    • value: closed
      label: DOOR IS CLOSED
      color: green
      icon: mdi:garage-variant-lock

Final Thoughts
This project has been a great learning experience, and I’m thrilled with how it turned out. The integration of the Shelly 2.5 with Home Assistant has made my garage door automation seamless and reliable. I hope this guide helps others looking to set up a similar system!

If anyone has questions or suggestions, feel free to reach out. Happy automating! :rocket: