Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cransom
Created September 27, 2019 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cransom/80a39b54a58cd0440c6852f9fb427dec to your computer and use it in GitHub Desktop.
Save cransom/80a39b54a58cd0440c6852f9fb427dec to your computer and use it in GitHub Desktop.
If i were to IOT a garage door now...

My implementation 4 (or more?) years ago was:

  • wemos d1 mini module
  • hc-sr04 ultrasonic distance sensor
  • photo resistor (measure light level from the automatic light or ambient if open)
  • wemos 1ch relay. could have used a transistor, but i am iffy on what kind of voltage the garage button is using. electrical isolation is nice. my button does have couple modes like turning a light on as well if you let some amount of voltage through, but i didn't go there
  • hacked up arduino code using mqtt and some very fiddly json parsing that's frafile if you glance at it weird. the software didn't exist when i hacked mine how i wanted it.
  • homeassistant doing all the home automation things. It hooked into Homeassistant via MQTT sending messages back and forth. The distance sensor could only really tell if you the door is nearly all the way open due to how it was mounted. Knowing closed would be nicer but i would have had to mount it farther away and it's been fine so far.

I 3d printed a case/mount for it to dangle above the door from the ceiling, with distance sensor pointing down. relay wired to the same terminals (common and normally open) as the button on the wall would use.

all of the smarts of knowing if door was open or closed or what to do with the lights is in homeassistant. there are crazy amounts of examples of what you can do there (like, garage door opened event, flip on lights, have bartender bot standing by with your cocktail of choice. assuming it's after noon. or not. we don't judge here.) what I would do now:

Same hardware.

Software, either:

  • Tasmota (https://github.com/arendst/Sonoff-Tasmota)
    • mqtt only, but it has plugins for every sensor I've ever wanted to look at and doesn't require a reflash to switch things around. Configuring pins from a graphical ui is interesting.
  • Espurna (https://github.com/xoseperez/espurna)
    • does mqtt as well as straight http. If you didn't want to run an mqtt server and just wanted to curl button clicks to your relay, it's as good as any. I think it's very opinionated on how you plug things in, but i have it running some lights and other relays.

either work well, tasmota is just slightly more fun and mqtt is a fine protocol. can back up configs (or preset them with compiled firmware) and flash over the the air.

the espurna compatibility list has some ready made gear with relays you could use without ordering components separately. everything with espurna would work with tasmota i'm sure.

@cransom
Copy link
Author

cransom commented Sep 28, 2019

esphome looks cool too. i haven't used it, but i intend to check it out as it seems to do things that tasmota and espurna don't (like support deep sleep)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment