Garage door Mqtt

Hi,

I’ve installed Wemos D1 for opening the garage door. Everything works fine.

But now I’m looking for a sensor that gives feedback when the door in opening and closing.

I already use a reed switch, but it only tells when the door is open or closed.

Any ideas?

tilt Switch
Mercury Switch
other reed switch

1 reed switch at close other 1 at open

so when the both are open door is some between open / close

1 Like

Hi

nice i’ma help for a change :wink:

My idea would be to use a distance sensor. Ultrasound for a rolling door and laser or infrared for one thats stored in the ceiling.

I assume you know how to get the sensor data into your arduino or wifi capable arduino equivalent.
I also assume you know how to program the wifi and how to send mqtt messages to your ioBroker.

If not here is a german tutorial on how to setup a temperature sensor with mqtt:


The interesting part is the code snippet.

So now i assume you mounted the sensor and stuff on you garage door, so it can measure either how much is rolled up or how much is stored in the ceiling so far.
Write a simple program which throws the sensor value into the console

Open the Door completly > Note the Value
Close the Door completly > Note the Value

Now for the programming part (i don’t have a garage door so just a simple mock up:

loop:
if garage door distance is below “open Door Value + a margin” send MQTT “open”
if garage door distance is above “open Door Value - a margin” send MQTT “closed”
if garage door distance is lower than last loop send MQTT “opening”
if garage door distance is higher than last loop send MQTT “closing”
sleep 500ms

If you set the conditions up like this a hard wind won’t trigger opening and closing messages and you don’t have to use margins for opening and closing because it will always go into one of the first to conditions even if it shifts a bit.

You could also simply send just the sensor data via MQTT Message and do the automation there…

That got a lot longer than i expected…

now why put a other Ultrasound sensor on the wall so you them know when the car is in or out

all you could get to flash the light when to close to wall