# Smart Garage Hack

> A Sonoff SV garage-door controller on Home Assistant, MQTT and Alexa: monitored as well as controlled. Design later sold.

Canonical: https://mikereams.com/work/smart-garage

Year: 2019  
Link: https://www.hackster.io/mikereams/my-first-smart-garage-2dca85  
Technology: Amazon Alexa, Amazon Web Services, Docker, Home Assistant, MQTT, Tasmota  
Topics: IoT, Home Assistant, Sonoff, Arduino, MQTT, Integration, Cyber Security, API, Cloud Computing

![Smart Garage](https://mikereams.com/work/641374e962921ce958388df1d563309ff5bf5681-723x555.jpg)

## The problem

Two practical ones: never wondering whether the garage door was left open, and letting someone in when I'm not home. I also wanted the door's history over time, along with temperature and humidity — not just a remote button (yes, the clicker works fine).

## The build

- **Controller:** an Itead Sonoff SV flashed with Sonoff-Tasmota firmware, housed in a soap-box enclosure.
- **Door state:** a wired magnetic reed switch, with the magnet mounted on the door itself.
- **Environment:** a DHT11 temperature and humidity sensor on GPIO4.
- **Integration:** MQTT into Home Assistant as a garage-door cover, with Amazon Alexa voice commands ("OK, opening garage door one") through Home Assistant intent scripts.

## One design choice worth copying

The relay switches itself off after one second using a rule on the Sonoff, instead of waiting for Home Assistant to send an off command over MQTT. That saved 300–400 ms, removed an external dependency, and means a lost message can never leave the opener's button held down.

## Outcome

An intermediate build of about two hours. I later sold the design and concepts to an investor.

The full build — wiring, Tasmota commands and the Home Assistant configuration — is on Hackster. Code: the [Sonoff SV sketch](https://github.com/solventarchitect/Sonoff-SV-Smart-Garage) and the [MQTT Sonoff configurations](https://github.com/solventarchitect/MQTT_Sonoff).
