mmmries

mmmries

Gotta love that uptime

Just logged into my raspberry pi that I use as a garage door controller and saw this

████▄▄ ▐███
█▌ ▀▀██▄▄ ▐█
█▌ ▄▄ ▀▀ ▐█ N E R V E S
█▌ ▀▀██▄▄ ▐█
███▌ ▀▀████
garage 0.2.0 (32d4ac88-9d52-5173-f118-86c36714154b) arm rpi3a
Serial : 0000000089bf37cd
Uptime : 141 days, 1 hours, 2 minutes and 14 seconds

141 days running with no restarts. I use it to open my garage from my phone and my car and to check the status of the garage door if I’m away from the house. It’s connected to a NATS server to interop with a hosted website that handles authentication/authorization. Thanks @fhunleth @jjcarstens and the other maintainers.

Most Liked

jjcarstens

jjcarstens

Nerves Core Team

Whoa! So fun. You got me curious - I have a similar home controller which does simple functions. Not as cool an uptime (we had a power blip :face_exhaling: ), but it is still running Elixir 1.10.3 released April 25, 2020! (Maybe I should be ashamed of that). Truthfully left alone for so long that I had lost the SSH key on it, but had left Erlang distribution running and was able to get in with -remsh!

mmmries

mmmries

I decided to a minimal write-up in case it’s useful to anyone else. The project really centers around 2 components:

  • Sensing the state of the garage door (may not matter to some folks). I use a hall effect sensor + a magnet stuck to the side of the door so I can sense when the door is closed
  • Triggering the garage door opener. This is really easy, most wall-mounted buttons just create a connection between two terminals on the side of the garage door opener, so we mimic this same thing by connecting a relay to those same terminals and we an just close the relay for 500ms to simulate pressing that button

Then in my repo you can see that the nerves config is just starting a couple of GenServer’s to watch the input from the hall effect sensor and publish state changes to a NATS topic. Similarly it listens to a NATS topic and triggers the relay.

I have a little phoenix app that is running on fly.io that connects to those same nats topics. It uses OAuth with google and has just 2 email addresses allowlisted for which authenticated users are allowed to “click” the button which will trigger the NATS message back to the nerves device.

I went with a hosted app since I wanted to be able to remotely monitor the door and I didn’t want to wait on WiFi connection before I could push the button from my car. But you could easily run NATS and Phoenix locally if you prefer that for privacy/simplicity reasons.

lawik

lawik

Nerves Core Team

That’s awesome!

I’ve just started to put my Nerves devices to work for home automation. Homex is pretty nice for getting sensors out there. I need to try some switched and stuff as well which I guess you’d need for a garage door :slight_smile:

Then again, if it ain’t broke …

Last Post!

jc00ke

jc00ke

Yes! Thanks for the write-up and sharing the code! I’ve wanted to do something like this for so long. Part of what I’m waiting on is to build a home server, and my plan is to connect via Tailscale, but nothing is set yet.

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
f0rest8
Hi everyone :waving_hand: Posting here to showcase and announce that Metamorphic is now officially live on a public-facing domain at htt...
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement