Wemos D1 Mini garage door opener with Home Assistant

wemos D1 mini garage door opener

A mate asked me to connect up his garage door so he could control it from his iPhone, when we did the front garage door we used a Wemo Maker that could be controlled from the Wemo app or via Home Assistant. It worked so well that he decided to add a motor to his rear garage door. By the time he did this not only had Wemo pulled out of Australia but the Wemo Maker was out of production worldwide.  So it was up to me to come up with a new solution to which I replied Wemos D1 Mini (no relation to Wemo),a Relay Shield and Tasmota firmware.

The plan was to emulate the Wemo Maker as much as possible. When we added the Wemo Maker to his front garage door on my previous project, we found all that was needed was to pulse a relay across the garage door motor’s momentary switch contacts. We also added a reed switch to the door so that you know it is closed.

Hardware

For the reed switch we used this alarm type switch that mounts to the ground with a magnet mounted on the bottom of the rolladoor.

For the electronics we used a Wemos D1 Mini and a matching Relay Shield.

The reed switch connects between pin D6 and GND while the connection to the roller door motor switch contacts connects to the Normally Open output of the relay.

wemos garage relay

Tasmota Setup

First flash the Wemos D1 Mini with the Tasmota firmware, If you have not done this before follow my guide here. Once connected to WiFi go to the Tasmota interface and set up your device as generic with the below options. Also ensure you have setup the MQTT settings of your Broker so the device can connect to Home Assistant.

 

 

 

 

 

 

 

 

 

Tasmota Commands

Next we will need to run a few commands, type out below between the quotes into the console section of the Tasmota interface and press enter on each command.

“pulsetime1 1” This makes the devices relay activates for a second, The garage door will think it’s you pushing a button.

“Switchretain 1”. This will make it so that Home Assistant gets the last state from the door sensor after a reboot.

“Powerretain 1”. This will stop the relay from randomly triggering when the Sonoff disconnects and reconnects to the MQTT broker.

Home Assistant Configuration

Now we need to setup Home Assistant’s configuration.yaml with the the below settings. Check your config and restart Home Assistant when done.

cover:
  - platform: mqtt
    name: "Rear Garage"
    state_topic: "stat/garage/POWER2"
    command_topic: "cmnd/garage/POWER1"
    payload_open: "ON"
    payload_close: "ON"
    payload_stop: "ON"
    state_open: "ON"
    state_closed: "OFF"
    retain: false

If all went well you should now have a garage entity in Home Assistant. Hitting up or down will trigger the pulse the relay while shorting out pin D6 to ground will indicate the door is closed.

To get the entity to appear as a garage go to Configuration and the Customization in the Home Assistant web UI and find your new entity, then change the Device class to garage like below.

ha-customization

If all went well your cheap DIY garage door opener will appear to Home Assistant in a very similar way to the pricey commercial built alternatives. The only downside to this project is there is no second point of external control unlike the Wemo Maker that could be controlled from either Home Assistant or the Wemo App.

Resources

Flash Tasmota the easy way
Tasmota

Parts Used

Wemos D1 Mini
Relay Shield
Screw terminal block

3D Printed Parts as shown

Base
Top