GarHAge - a Home-Automation-friendly ESP8266-based MQTT Garage Door Controller

I guess thus it what I need to get? I checked your hardware list, excellent!

Any tutorial (YouTube video perhaps) for the hardware side, or just some pictures on how to connect all hardware?

Just a quick update to my garage controller.

now Android Auto supports full Google Assistant. I have linked IFTTT to google assistant on my phone ,

So while driving in the car, towards the garage, with Android auto hooked up … i say
“ok google " " open garage”
Via IFTTT a webhook is called using the API service for MQTT exposed by HA to publish a simple Json call …
{“topic”:“devices/Garage/switch/on/set”,“payload”:“Yes”}

Garage Door opens.

Also the same for Close Garage, when i’m driving down the street away from the house

Note:
Web hook url : http://YOUR.INTERNAL.IPADRESS:8123/api/services/mqtt/publish?api_password=XX

3 Likes

Was curious of anyone had a design for a 3D printable enclosure for the NodeMCU and relay?

@walt Take a look at Aderusha’s Github

Quick question
I had a Pi/relay running my garage door. Had a simple webpage on it with one single button on the page. Press the button and the relay fired opening the door. Long story short I wanted to use the PI for something else and wanted to try the 8266 version. I switched to the ESP8266 and same relay with reed switch. The reed switch is reading fine but now my manual garage door button doesn’t work and the car remotes no longer work. Opening the door from HA is the only thing that works. When I disconnect the relay from power (removing the VCC pin jumper), car remotes and physical button works again.

I loaded the ESP just like the GitHub page showed. I’ve had the relay for quite some time and can’t remember if it’s an open or a closed. Would programming it as open and the relay being closed cause this or am I missing something?

So sorry I said open/close when what I meant was High/Low

Been up and running for a few weeks now. Love having the doors connected to both Alexa and Siri through Home Assistant as well.

I have had about once a week the status of the cover change to “Unavailable” – I haven’t don’t any troubleshooting yet, but I did see that I can still ping the nodemcu when it’s in this state.

Any advice on what to start checking? Is it the LWT MQTT message being published that marks it as “unavailable”? And would it seem that my board is never reconnecting to my MQTT broker?

@walt - correct that it’s the LWT message that marks it unavailable; when GarHAge comes back online (reconnects to the broker) it publishes a message that should set it available again. Couple of things could be happening - next time it happens, use an mqtt client to subscribe to the topic “GarHAge/availability” on your broker. If the retained message on that topic is “online” then the problem is in HA. If the retained message on the topic is “offline” then at least the HA side is ok and there’s something about either your ESP or my code that’s causing either the ESP not to reconnect or not properly publish the online message on reconnect.

Are you on the latest HA version?

Thanks @marthocoo , that will help down the right path – I’ll check the retained messages next time and see what they spit out. I’m using the built-in MQTT broker on HA 0.64.3.

A few maybe related questions – Does the loop() ever check the door status or does it reloop before it gets there?

I noticed that the BruH multisensor I put together today calls ESP.Reset, and there is a note in the header about better stability there – Would that help?

Inside of the sketch’s loop(), client.loop() is a PubSubClient (MQTT) library function that does MQTT related tasks each loop (processes incoming messages, maintains broker connection). Door status is checked on each loop (if you want to test this, open the door externally to GarHAge (ie by hand or remote). If the status updates in HA, you know the check_door_status() functions are doing their job (spoiler alert, they are :wink: ).

1 Like

Just quickly glanced at the code - it looks like if the mqtt client disconnects, instead of allowing client.loop() to handle reconnecting, BRUH’s code just resets the program to connect from the beginning. I’m not sure if this is better - it’s still PubSubClient that’s handling the connect/reconnect and that’s what client.loop() is for. As to whether it would help, let’s see whether we can more precisely nail down where your problem lies before we start trying to fix it :slight_smile: . There was a known problem in HA that if two entities registered callbacks for the same mqtt topic, a race condition may have prevented one of them from receiving the message when one came in. I think this has been fixed as of the latest version, so maybe this isn’t it, but I haven’t kept up to date on the GitHub PRs dealing with mqtt issues.

just a thanks here, i’ve used it for my roller door and my electric front gate so far, in the process of figuring out a few code modifications to drive a DC motor up/down to limits for an automatic chicken pen gate i’ve been working on too.

This is an excellent project, been using it for months! No issues.

You code rocks! One of the things I wanted to do when I stated playing with HA was to monitor and control the garage door. I knew what I needed for hardware so I first started looking to see what others did for the software side. I found GarHAge and said, ‘software is done, time to build the hardware.’ I have a single garage door so I was able to easily cram everything on to a Wemos D1 Mini shield. To save space and be able to stick with 3.3v switching I skipped the mechanical relay in favor of a solid state relay (MOSFET output optocoupler ). I had a TS117 chip in my electronics box and it fit the requirements. I also added an I2C header to the shield so I can add a temperature sensor in the near future. Thanks for your well thought out code, I appreciate your work.

shield

Looks great! Love the compact design.

Have a look at the dev branch on GitHub, it has code ready to go for adding a DHT sensor (I’d recommend DHT22, more accurate and bigger measuring range). The dev code may change before it gets merged to master but I am hoping to finish documentation and release in the coming days.

I have a DHT22 right now on one device but I’ve been looking at the the BME280 as well, the BME680 looks great for the garage as well but the price is a bit higher. I’ll have to do some digging to see if anyone has done a comparison.

I have a single garage door, and I am able to control the door and the light built into the opener, by connecting to the connectors on the buttons on the wall switch for the opener. Is it possible to use this and have one relay control the door, and the second relay control the light? the light state wouldn’t be known as its just a momentary toggle to turn it on or off. I guess I could just change the topic for the second relay, and ignore the status input?

Sure you should be able to use the other garage relay, you can I believe set the light to optimistic mode (or maybe it will do that automatically if there’s no state topic), which means the light in HA won’t wait for a state message before changing states. This does mean that sometimes the state in HA won’t be sync’ed with the actual light.

I just managed to fry my garage door opener. Got the garhage project up and running and then connected it to the terminals on the wall switch (I have a Genie Max opener). The relay worked fine in response to commands from HA, but the garage door wasn’t opening, so I manually shorted the terminals on the wall switch to see if that would trigger the door, and the Genie went dead. There is a little circuit board inside the wall switch doorbell thing that I guess is sending an encoded signal which I bypassed, thus causing some damage somewhere. Have a service call in to see about repairing the damage; I hope it’s just an internal fuse or something, but my little 25$ project just turned into a $125+ repair. Oh well.

Has anybody had any issues with remotes being inconsistent after installing this? It 100% could be my wiring job but ever since I got this working the remotes seem to not work at first. Once the garage door is opened by another means (wall opener or HA) they seem to work most of the time for a little while. But if the garage door hasn’t been opened for a while, they seem to stop working. Any suggestions you guys might have would be much appreciated!