Platform
Docs
Solutions
ContactLog In

Start Routing Notifications Today!

Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.

Sign-up

raspberry-pi-leaks-header
COURIER

How I Used Raspberry Pi to Detect Water Leaks in My Home

Suhas Deshpande

April 14, 2022

When I realized there was a leak in my home, I knew it was time to put my expertise to work. I needed to call on my years of experience and passion for my job - as a software engineer? While at first glance, it may appear that a plumber would have been a better option, my argument is that there is a step to be taken before a plumber is even involved to fix a leak. And that is to detect the leak when it first happens.

Sure, I could have a plumber on call who checks for leaks every day, but seeing as that’s not an effective use of time or money, we needed to find an alternative to waiting for the problem to become bad enough to become a major problem. So if a 24/7 plumber-butler wasn’t an option, I thought some kind of automated system would be more realistic.

As it turns out, I had been thinking for some time about how to use a Raspberry Pi with Courier to bring notifications to life. This happened to be a perfect use case to try it out, so I decided to invest in the appropriate hardware and make use of my own software development skills to make sure that I would get a notification any time there was even a small leak in my home. This way, I’d know to call the plumber and handle the problem before it became too big to handle.

A leak can become an expensive problem

I myself had a water leak in my apartment some time ago. Because I didn’t know there was a problem until it was already too late, I had to call for a plumber when the damage was already done. Even for a simple leak like this, I ended up spending more than $500 to fix it.

But things could have been much worse. Major damage is often caused by mold spores. Water leaks may also cause structural damage to property. Walls start swelling and warping, leading to cracks and holes in them. Furthermore, water leaks may negatively impact the value of a home.

I never wanted to deal with the complications, so I decided to take matters into my own hands. But of course, it was important to find a solution that would be fun and interesting as well as useful.

Building alerts for water leaks using Raspberry Pi

During my research for a solution in the form of alerts for water leaks, I found that I could use a small, affordable Raspberry Pi single-board computer to achieve my goal. With this tiny computer, I could read signals from my water sensor and then send those signals to my monitor.

To develop the project, which I called potential-octo-lamp, I first got all the hardware I needed to detect water leaks and connect to my computer. These devices included:

With Courier, I could create custom alerts and define their titles and body text. I could also specify the communication channels through which the alerts should go and the recipients of these alerts. I also added a Twilio integration on Courier to deliver the contents of my alerts through the channels I specified — in this case, SMS and email.

How to use potential-octo-lamp to get alerts

Luckily, I’m a really nice guy and have made potential-octo-lamp open source. You can use my program to protect your own home from water leaks. Once you have all the hardware requirements listed above, connect your Raspberry to your water sensor. If you need help setting them up, this tutorial will help. Then you can begin using potential-octo-lamp to receive alerts for water leaks in five easy steps:

1. Create Your Courier and Twilio Accounts

If you don’t already have Courier and Twilio accounts, you’ll need to sign up for both to configure your alert system. You may sign up for free on Courier and Twilio using an email address. Courier also allows you to use your Google or GitHub account to create an account.

2. Add Your Twilio Integration in Courier

Start by getting your Account SID, Auth Token, and messaging service SID from Twilio. Then log into your Courier account and go to Integrations. Add the Twilio info to their corresponding fields in Courier.

3. Retrieve Your Courier Authorization Token

When you create an account with Courier, you get an Auth Token so that you can safely make requests to and from Courier. Once logged in, you may retrieve your Courier Auth Token from the API keys page in Settings.

4. Clone potential-octo-lamp and Add Your Courier Auth Token

Next, go to GitHub and clone potential-octo-lamp. Because it’s unsafe to input your Courier Auth Token directly in your code, create a .env file and add it there. That way, it’s only visible to you.

5. Start the App

Finally, run the following commands one after the other to install dependencies and start checking for water leaks:

npm install

npm run build

npm run start

As soon as your floor water sensor detects leaks, potential-octo-lamp sends alerts for water leaks to the recipients you added on Courier. Then you can quickly repair the leak to prevent further damage.

Alerts are your answer to urgent situations

Potential-octo-lamp is open-source, so you can clone it and use it yourself. Any improvements or suggestions you may have are also welcome. You can raise an issue or reach out to me if you’d like to contribute to the project!

Create custom alerts like mine. Sign up for a free Courier account and explore.

Start Routing Notifications Today!

Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.

Sign-up

More from Courier

data-thumbnail
COURIER

Tools and Techniques to Establish Your Data Team Early

How tools like Segment, Metabase, Snowflake, Census, and others, can help establish a data team from the very early stages in a startup.

Raymond See

Raymond See

February 16, 2023

QOTD Thumbnail
ENGINEERINGCOURIER

Develop a Motivational QOTD with Courier and GPT2

Courier and OpenGPT2 in action: build a service that sends friends and family an AI generated motivational quote of the day.

Prakhar Srivastav

Prakhar Srivastav

February 09, 2023

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Platform

Users

Content

Channels

Sending

Workflows

Preferences

Inbox

Workspaces

Observability

API Status

Changelog

© 2024 Courier. All rights reserved.