I know i'm not the only person that has fallen victim to hungry roommates who for some reason don't ever keep enough food for themselves on hand. I've had too many occurrences where I go to the kitchen thinking about some food that I know I just bought a few days ago only to find that it's been ravaged by the worst kind of people out there. To solve this problem I decided to make something that lets them know that I know what they're doing every time they open up my food cabinet.
This Project is essentially just a photon with a PIR sensor that detects motion, triggers the D7 LED, and publishes "Full" or "Empty" using the Particle.Publish(roomstatus) function, the second photon then is subscribed to the roomstatus function. Once data is received it prints one of two messages onto the OLED screen, makes a buzzing noise if it detects that the motion sensor was tripped, and publishes one of two functions (Room_Full or Room_Empty) which a slack webhook picks up and sends a notification straight to your phone. It also logs the time and status of the photon when the roomstatus event is published via a google docs spreadsheet.
Most of the project is plug n play but you'll have to set up a few integrations to get everything running correctly. If you want to get notifications every time the beam is broken directly to your phone via the slack app you'll first have to set up a slack account. Start by visiting Slack.com and creating a channel that you'll want your notifications sent to. Since we're using a motion sensor you can name it #motionstatus. Then click Add an app or integration
Then search for incoming webhook
Then add configuration
Then finally click the #motionstatus channel and you should be taken to the "Edit Configuration" Page. From here copy the webhook url as that's what you'll need to put into the Particle Console Integration. Scroll down and you can change the emoji and name of this webhook that will appear in the #motionstatus channel.
Now go to console.particle.io and add an integration
Click webhook to begin building the webhook integration
Now you'll need to do this next step twice, do it once as shown in this picture, then again but replace "room_empty" with "room_full" and change the text to whatever you want the notification to say when that event is triggered. Also be sure to click advanced settings and under "Send Custom Data" click "JSON"
This should have your slack channel running perfectly, all you have to do now is download the app on your phone and sign in to have the notifications whenever the cabinet or wherever the motion sensor is placed is disturbed.
If you want to setup a google drive spreadsheet that updates every time the roomstatus function is triggered then simply go to IFTTT and create a new recipe, choose Particle "New event published" and fill it out as seen below,
then choose google drives "Add row to spreadsheet and fill it out as seen below.
This gives a good spreadsheet that has the Date, Time, and Full or Empty status displayed on each row so you know when the motion sensor was last triggered
If you input the code correctly and have all your wiring diagrams set up you should be ready to place your motion sensor and relay photons somewhere, make sure the OLED screen is visible, and wait for a thrifty roommate to try and take your snacks. Without the OLED Screen and buzzer this is still a great way to have a motion sensor somewhere in your house, you could hang it over your door and move the room_full and room_empty functions to just the motion sensor photon in place of the roomsensor publish function. Then you would have a small almost not noticeable motion sensor that gave you a push notification every time somebody came through your door. Here's a link to a video that shows how the cabinet motion sensor works once placed and activated.
Youtube Video: https://www.youtube.com/watch?v=TkWF1DUOX-A
Comments