Code Monkey home page Code Monkey logo

pi_doorbell's Introduction

pi_doorbell

The setup scripts and run scripts for running my DIY doorbell notifications from a raspberry pi

This is designed to run on a Debian based operating system. I used Rasbian with a Raspberry Pi B. You may need to change a few things in order to get it working with other Raspberry Pi models.

Setup:

Install dependencies:

Start by install all dependencies first.

sudo apt-get install -y \
    git \
    python3 \
    python3-rpi.gpio \
    python3-pip

sudo python3 -m pip install -r requirements.txt

Build and install from source:

Clone this repo or download the latest source.

eg.

git clone https://github.com/Josh5/pi_doorbell.git /opt/pi_doorbell

Run the following commands to install the python module

cd /opt/pi_doorbell
python3 ./setup.py build
sudo python3 ./setup.py install

Configure pi_doorbell

Start by copying the default config file.

sudo mkdir -p /etc/pi_doorbell
sudo cp -f /opt/pi_doorbell/config/config.ini.sample /etc/pi_doorbell/config.ini

Once this is installed, you can edit it to suit your needs.

sudo nano /etc/pi_doorbell/config.ini

Create systemd unit

Ideally, we want this to run on startup.

First find the location where the pi_doorbell script was installed.

which pi_doorbell

You should see an output something like this: " /usr/local/bin/pi_doorbell "

So we will create systemd unit for the Pi Doorbell Notifications by running this command:

sudo nano /lib/systemd/system/pi_doorbell.service

Populate the unit file with the following text (changing the path to pi_doorbell according to what was returned above):

[Unit]
Description=Pi Doorbell Notifications
After=network-online.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/pi_doorbell -d
TimeoutSec=30
Restart=always
RestartSec=10
StartLimitInterval=350
StartLimitBurst=10

[Install]
WantedBy=multi-user.target

Enable the newly created systemd unit

sudo systemctl enable pi_doorbell.service

Now the Pi Doorbell Notifications service will run whenever the RaspberryPi starts.

To start it now without needing to reboot, run:

sudo systemctl restart pi_doorbell

Update:

To update, cd to the path where the pi_doorbell project was cloned.

Run these commands:

cd /opt/pi_doorbell

git checkout master .
git pull origin master

python3 ./setup.py build
sudo python3 ./setup.py install

Restart the process to have changes come into effect

sudo systemctl restart pi_doorbell

Debugging

If you run this as a systemd unit, you can tail the logs using journalctl

journalctl -u pi_doorbell -f

If you want to see more info, then edit the config file in /etc/pi_doorbell/config.ini, setting debugging = true.

pi_doorbell's People

Contributors

josh5 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.