Git Product home page Git Product logo

i-hate-doors's Introduction

I really hate doors (and people)

You know that feeling when you're on a Discord call, you don't want to be disturbed, but someone constantly feels the need to come and disturb you? This simple project can put you out of your misery.

How it works?

To detect room entry, you place a Raspberry Pi Zero with an ultrasonic sensor above the door. Whenever the door closes/opens, the Raspberry sends a message to the MQTT broker (itself). The desktop client then responds to this message by virtually pressing the mute/unmute key.

Client

Client

Server

Server

Buttons

  • top button
    • used to initialize pairing with client (lasts 30 seconds)
    • client waits for server to send pairing packet
  • middle button
    • on/off
  • bottom button
    • shuts down Raspberry Pi

Beep codes

one short connected to MQTT broker
two short server stopped
three short disconnected from MQTT broker
one long pairing started
two long shutting down
three long failed to connect to MQTT broker

Installation

Installing and configuring MQTT server

sudo apt update
sudo apt upgrade
sudo systemctl enable mosquitto

In /etc/mosquitto/mosquitto.conf make the following changes:

listener 1883 0.0.0.0
allow_anonymous true

Then restart MQTT server:

sudo systemctl restart mosquitto

Installing server

cd your_download_folder   # optional
git clone https://github.com/jsfraz/i-hate-doors.git
cp -r i-hate-doors/i_hate_doors_server your_desired_folder   # optional
cd your_desired_folder/i_hate_doors_server
pip3 install -r requirements.txt    # installing python libraries

Running script as service

Create new file /etc/systemd/system/ihatedoors.service and paste the following (don't forget to modify the path):

[Unit]
Description=I hate doors
After=multi-user.target

[Service]
Type=simple
ExecStart=python3 your_desired_folder/i_hate_doors_server/main.py
Restart=on-abort

[Install]
WantedBy=multi-user.target

Then reload the daemon, enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable ihatedoors.service
sudo systemctl start ihatedoors.service

TODO

  • release client executable
  • power from lithium battery
  • create PCB and 3D print case
  • MQTT security

Disclaimer

This is intended for home use, communication with the MQTT server is not encrypted in any way.

i-hate-doors's People

Contributors

jsfraz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.