A toilet queueing app for serious poopers. Uses resin.io, firebase and twilio to notify people when the toilet is open – runs on the RPI.
I just moved into a three story house with 6 people and 1 toilet. Running down stairs every morning to find the bathroom occupied became a common annoyance for everyone in the house. So I made this monitoring system so we can check if anyone is in the bathroom from the comfort of our rooms.
The project is pretty simple. It uses a magnetic reed switch to check if the door is open or closed. On a change event it updates the data on firebase and the data on firebase is then synced with the frontend. If there is anyone in the cue when the door is opened it'll send them a text from twilio notifying them that the toilet is now available.
The device side code is written in python. The front-end is powered by firebase's angular-fire which allows the data on the front-end to be updated without a page refresh or an ajax method, which is awesome.
I've detailed the steps below so you can knock up your own occupied app if you are facing a similar issue.
Step one: Sign up for third party apps
Resin.io, is a update platform that uses docker and git to allow you to update code on your Pi over the air. It also makes the initial set up a breeze.
2.Sign up with firebase, create an app. And create a simple data store layout like this.
Then signup with Twilio, and verify all your housemates or colleagues phone numbers. (If you have a paid account you won't have to verify the numbers).
Step 2: Add environment variables to resin app
Add all API keys and housemates phone numbers as environment variables on the resin app page. Adding them as envars, keeps 'em out of your code base making it safer and easier to update on the fly.
import os # CONFIG fbRef = os.getenv('FIREBASE') twilio_acc_id = os.getenv('TWILIO_ACC_ID') twilio_acc_auth_token = os.getenv('TWILIO_ACC_AUTH_TOKEN') twilio_number = os.getenv('TWILIO_NUMBER')
Step 4: Connect your Pi to the reed switch and then to resin.io
Solder the reed switch to some female connectors and connect them to the appropriate pins.