Wifi Garage Door Controller using an ESP8266/Wemos D1 Mini, HASS, and MQTT

Here’s the link to it.

It’s got the code for the ESP, along with a schematic, and pictures. It has has the configuration for the MQTT Cover component to integrate it with HASS. Feel free to ask any questions you might have about it.

I also have HASS configs to be able to notify you every thirty minutes in case the door is left open. I can post that if anyone is interested in that.

And if there is any interest in this, I am also controlling my gas fireplace using HASS and a Wemos D1 Mini. I can create a post about that as well if anyone wants me to. It’s a cool little project for about $5 worth of parts.

9 Likes

Fireplace notes plz… :slight_smile:

1 Like

I try to write it up this week then. The ESP code is fairly similar to the garage door opener minus the door sensor.

Thanks for sharing. Very useful information for a n00b like me. Maybe a silly question: didn’t you find issues when driving the 5V-relay with the D1 mini? I understood that all IO pins run at 3.3V.
Thanks again and I also encourage you to write the fireplace notes :slight_smile:

1 Like

@timseebeck, The Wemos has a 5v pin on it coming off the microsusb. That goes to the 5v pin on the relay. I believe that’s what actually powers the relay. The other 2 pins go to Ground and a digital pin on the wemos. That’s what actually controls it. From my understanding at least, the input pin on the relay doesn’t actually need 5v, and 3v3 is enough. I’ve never had a problem with it, and I’ve probably triggered it a few hundred times between this and my fireplace project.

Let me know if you have any questions. I tried to make my instructions and my code comments so that someone that is starting off would be able to understand it.

1 Like

@mattvirus I finally got around to doing a write-up of the fireplace. Let me know if you have any questions about it:

Actually saw this already…Thanks! Popped up on my Google news feed the other day. I’m going to cut the ties to mains on my electrodragon unit so I can use the onboard relay to control the fireplace. Relay is connected to 110v in stock form but easily modified…

This works great. I would like to add “Door State” to the cover. I cannot find a way to do this, any suggestions? I know I can see that state by looking at the grayed out arrow but I would like to just add “Open” or “Closed” as a separate line item.

In that case a binary sensor might be the way to go for you.

I added the binary sensor but it toggles between off and on. Obviously I have something wrong in the code below. How do I get Opened and Closed instead of off and on?

binary_sensor:

  • platform: mqtt
    state_topic: “garage/door”
    name: “Door Status”
    qos: 0
    payload_on: “CLOSED”
    payload_off: “OPENED”
    sensor_class: opening

I don’t know the exact code to use, but try using the Template Binary Sensor. Grab the state of the garage door.

Thanks, I got it working with the template binary sensor. It took a bit to figure it out but it works. Oh, how things have changed since my college days of Fortran 77…

Now its; time to add a DHT sensor to this ESP8266.

Awesome. Don’t forget to.post the code here. I’m sure hat if you are asking about it, there will be someone in the future that will want to do the same.

This is code I used to display “Opened” or “Closed”.

sensor 8:

  • platform: template
    sensors:
    door_status:
    value_template: ‘{% if is_state(“cover.garage_door”, “open”) %}Opened{% else %}Closed{% endif %}’

Then I added that sensor to the Garage Group.

garage:
name: Garage
entities:
- cover.garage_door
- sensor.door_status

Thanks for all the help.

I do plan to add the DHT to the ESP next. I also plan to add a second relay to over-ride the safety sensor. I have run into a case where I was away from home and the door would not close due to a piece of paper that blocked the sensor. I will place this override in a hidden menu or password protect it so it does not get activated by mistake. I have a camera on a Raspberry Pi Zero in the garage, so I can verify what is blocking the door.

Hello, where you able to add the DHT?

I never did get around to this.