ESPHome garage door with single control

After some time using a custom arduino project with MQTT for my covers, I decided to update it to ESPHome.

EndStop and TimeBased covers don’t fits my needs, so I developed my own using template cover, but taking some logic from TimeBased cover in it.

EndStop And Timebased don’t suit to my cover because, it it’s own PCB with bultin endstops. So I wan’t to use the endstops to detect position but don’t want then to send a stop action when reached as this covers do. Also the door are commanded using a single control interface (like a button). Each time the control is activated the door performs an action with this logic: open-stop-close-open… So I need to implement some kind of state machine.

And here is the result: ESPHome Garage Cover Single Control

The project uses a relay to activate the door control and two reed switches to detect end positions.

Project features:

  • Position reporting based on time (no position control for now) and endstops sensors
  • Calculate the number of times the control need to be activated to perform the action requested
  • Actuate the door many times as needed to perform requested action. For example if position in memory is wrong or unknow because a external control stops the door at middle.
  • Detect and update position when the cover is externally commanded. Only if door is full open or closed when commanded or reachs end stop sensors.
  • Configuration options for GPIOs, debounce time, open/close durations. time between control actuation…

Now I’m planning to move to a custom component and implement position control, but I need to investigate how to have access to other sensors inside the custom_component.cpp.

I can share covers schematics and installer manuals if someone wants it.

PD: It is my first public project so, please be benevolent with me.

2 Likes

I have done something similar.

My project has only one reed switch (detecting closed state).
It supports the case when the doors are controlled via remote (wall switch or 433Mhz remote).
It supports the opening, closing, and stopped state.
It reports the position based on the time calculations (you can define the duration of opening/closing).
My door opener works the way that when getting the signal:

  1. If during the transition (opening/closing) it stops the door
  2. If is stopped (closed/opened/in the middle) it starts the transition opposite to the last one.

It supports the case when the door is reverted back if you have installed safety sensor/s.

It has additional functionality to turn on the light inside and outside but you can easily remove that part if not needed.

Alternatively, you can take a look at the gate opener which has very similar functionality but this opener works a bit differently which might suit your garage door opener.
It also has only one piece of information, but this time when the gate is open.

When the opener gets the signal from:

  1. From ESPHome device relay it doesn’t stop the gate but activates the opposite transition right away.
  2. The gate might be stopped via 433Mhz remote (which works the way same way as my garage door opener which is: stop - run opposite direction to the last one - stop - ...)
5 Likes

Thank you so much, I already have seen yours garage door opener before I started mine, so thank you again for inspiration.

I decide to use two reed switches because in this way, I include more scenarios and door status is more accurate when commanded externally.

I have one question, if the door is stopped in the middle externally (remote control or wall switch), your opener detects it? This is something I am wondering how to do it. My first idea is to use a timeout and if the door does not reach the endstop, assume door was stopped and set its position to 50%, but I would like to find a way to do it more precisely.

Finally, I suggest to have a look at the develop branch of my project, I migrated all code to a custom sensor simplifying the code and add more functionality.

I have to update the post, because it is a bit outdated, but my intention is to update it once I add position control.

Just Curious why you want to know the exact position of the door? It might take a little bit of tinkering with but you could easily add 25% 50% etc with a few relay toggles with delays. Tilt switches on a few spots could work too.

I’m not sure I understand you correctly. What you suggest is to add more reed switches at midlle positions (25%, 50%)…? I think it could work, but door is lengthly and wiring could be a little complicated.

The door has 6m length. We don’t open fully all there is no need for that. That’s why I want position control.
It will be easy if then only way to activate door is through ESPHome, I just activate the relay, calculate required time to be at % position and activate the relay once the time has passed.

The probem is when the door is commanded with a remote control or a wall switch, because my board doesn’t have knoledge of this commands. I’ve implemented a strategy to detect it, if a endstop is released. But, when the door is in a midle position I don’t have any sensor to know about that.

Problematic use cases:

  • On startup, if door is at midle, ESPHome don’t knows the last direction (need to know which will be the next direction when relay is commanded).
  • Door is stoped at middle with a extarnal command (not ESPHome).
  • Door is stopped, activated and stopped, all of them without reach a endstop, with external command (not ESPHome)

Now I’m thinking on add a CT Clamp sensor and measure motor energy consuption to know when it is activated or not.

To each his own and I commend you for the work your putting in but seems like an extreme case of over complicating a project just to know how far open a door is. Have you thought about just adding a camera in the garage? Would serve two purposes, security and a quick look to see where the door is.

Maybe you are true. I don’t care about my time, I enjoy this kind of things.
About the camera for me its not ok, two of the users, usually open it with voice command when in the car, so when they arrive don’t need to stop in middle of a slope.
The others users, dont use the smartphone and use the builtin 433Mhz of the door.

Thanks for your advice.

I have the same case according to the door position. I just did simple check with the timer. If the desired position is not reached then I assume that the door was stopped in the middle. To know exactly the position I might use ultrasonic sensor.

Hello;

I am using your project dev version and it’s working nice. Thank you.

Since the recent MyQ disaster I am very happy to be running something now local and reliable.

I also tried the master first, so I was happy to see the door track position when stopped on dev.

Thanks!

FYI, I developed GitHub - tronikos/esphome-gdo: Garage Door Opener/Cover with position control using ESP32 or ESP8266, relay, and one or two reed sensors that supports all the features mentioned here and more!

I’ve been using it successfully with just one reed sensor at the fully-open position but it should work with two reed sensors. I wanted the garage door to never close to less than 15% when the EV charging cable is connected and the car is on the driveway since I pass the cable under the garage door .

Thanks for sharing. It’s nice to have more options available.

Respect to my project, now I’m working on the migration from custom to external, but is taking long because I don’t have too much time. Seems you already did it, so I will take a look at yours!

And lastly, the develop branch (in my project) is the most updated one with more features that the ones mentioned here.