Integrating garage door with HA using Shelly Uni

Tomasz Urbaszek
5 min readSep 8, 2024

--

After long weeks of waiting we finally got our garage doors installed. From the very beginning I knew that I would love them to integrate with my Home Assistant. Luckily it turned out that I had everything that’s necessary: garage door control with plenty of external I/O and spare Shelly Uni.

Door control

My garage doors were installed together with GfA Elektromaten TS970 control device. As I had no experience with doors automation I need to do a bit of research. The TS970 manual (pdf link) came in handy as it explained pretty much everything I needed. There are two good things about the device: it’s pretty common and has plenty of integration options.

I/O terminals overview from TS970 manual

My first aim was to enable opening and closing the doors. From the beginning I knew that the X and X7 terminals are something that will be helpful — that’s where the radio receiver was plugged in. Terminal X provides 24V DC power for external devices. X7 is an input for a potential-free, impulse switch.

X (24V, GND) and X7 (7.1, 7.2) used for radio receiver wiring.

The logic of X7 depends on TS970 configuration (2.6 programming section). Basically there are three operating modes:

  1. Toggle the state, OPEN > CLOSE or CLOSE > OPEN
  2. Sequence OPEN > STOP > CLOSE > STOP > OPEN
  3. Always send OPEN command

My device was configured with option 2 and I haven’t changed it as it made most sense to me. If you wonder what is the use-case for option 3 — it makes sense when you configure automatic closing time.

On the side note, you can use X5 terminals instead of X7. X5 are for “external control device” and given the ability to trigger OPEN, STOP and CLOSE commands separately. This however means you need a 1–0–2 switch. As I wanted to use Shelly uni (only 2 out switches) it was not the solution.

Shelly Uni

The next step was to add smartness to the door control device. As I’m a huge fan of Shelly devices I decided to use a spare Shelly Uni I had in my drawer.

Shelly Uni board

The Uni is a 12–36V DC powered, small device with plenty of functionalities. It was perfect for my use case because I already had a 24V DC power supply and needed a potential-free switch (Shelly Uni has 2 of them). The wiring diagram for connecting Uni to TS970 is pretty simple:

The Uni is powered by 24V terminal. Output 1 is connected to terminals X7.

The tricky part is that the X7 input expects an impulse signal that is not offered by Shelly Uni out of the box. To achieve such behavior I had to configure one of the Out 1 switch with the auto-off option. The minimal configurable value is 1s and that does the trick (TS970 expects signal to have duration of min. 100ms).

Auto off option on Out 1 channel.

Adding the doors to Home Assistant

Shelly integrates smoothly with HA. Once I added the Uni device to the HA, I was able to open the doors by pressing the toggle switch.

There are problems with a toggle:

  • auto-off on the device causes the toggle to turn off after 1 second.
  • it does not correspond to OPEN-STOP-CLOSE behavior.

To improve the experience I created a stateless helper button:

Helper button invoking HA automation.

and simple automation that triggers physical switch:

alias: Grage door click
description: ""
trigger:
- platform: state
entity_id: input_button.garaz_drzwi
condition: []
action:
- type: turn_on
device_id: b89f5b0ea360099fc
entity_id: 1509d4e83f24a65b3
domain: switch
mode: single

Thanks to such an approach the experience is similar to the radio remote. With each press of the button you switch the state in a sequence.

Doors state

Opening and closing the doors was my main objective. But because I had to spend some time reading the TS970 manual I figured out that there should be an option to not only control the doors but also know the doors position. For me it would be enough to know if the doors are closed or not.

The state of the doors can be read from X20 terminal (potential-free relay contact). In fact there’s plenty (13 modes) of configurations for X20 (2.7 programming menu). I decided to use option 8: “In final limit position CLOSE: permanent contact”. This means that I can use one of the input switches of Uni and if it’s ON then the gate is closed.

The X20 is potential-free relay,.I decided to provide it with voltage from X 24V.

At first the switch showed up in HA again as a toggle. But because I wanted to use the switch as a sensor I had to change the switch mode to detached. In this mode the input and output of the relay are separated. As a result there’s an input sensor and output switch.

I didn’t need the switch so I hid it in HA. The sensor is what I wanted — representation of the door state. For better experience I set its type to “garage door”, in this way the HA automatically converts it state to “open” or “closed”:

The switch is the Out 1 on Shellly. The Input is IN 1 and is disabled as it has not function. The Garage door sensor is IN1 state.

I still have a few free I/Os on Shelly Uni so maybe I will figure out some more use cases (like attaching DS18B20 temperature sensor). But for now I’m quite happy with the setup.

--

--

Tomasz Urbaszek

Opportunity seeker, software engineer, open source enthusiast.