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 …

Where Next?

Popular in Discussions Top

sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
jeramyRR
This is an interesting article to read. Elixir’s performance, like usual, is excellent. However, it seems like the high CPU usage is co...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
AstonJ
Are there any Elixir or Erlang libraries that help with this? I’ve been thinking how streaming services like twitch have exploded recentl...
New
shishini
I think this twitter post and youtube video didn’t get as much attention as I hoped I am still new to Elixir, so can’t really judge ...
New
acrolink
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
jesse
Hi everyone, I hesitated to post this here because I don’t want you to think I’m spamming, but I’ve been working on a Platform-as-a-Serv...
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement