Skip to main content

PIR sensor state monitor, completely written in Python.

RPi.PIR is using PIR sensor with Raspberry Pi GPIO.

To connect to Raspberry Pi plug PIR into GPIO PIN 23 (Physical pin 16) and POWER PIN. Install and execute raspi-pir and it should work. Alternatively you can user different PIN and execute raspi-pir with parameter: raspi-pir --pin pin_number.

doc/RPi.PIR.png

RPi.PIR supports number of parameters and also configuration file. For more details see raspi-pir --help or sample config.

Sensor is based on RPi.Sensor library, which make base for implementing different types of sensors in Python.

Pre-Installation requirements

  • Update system and install required dependencies:

    sudo apt-get update
  • Update system and install required dependencies:

    sudo apt-get install build-essential python3-dev python3-pip

Installation

  • Install the latest released version using pip:

    pip install https://github.com/ricco386/RPi.PIR/zipball/master
  • Alternatively install latest released version from pypi:

    pip install --upgrade RPi.PIR

Integration as a systemd service

  • Make sure all dependencies (listed below) are installed (done automatically when installing via pip)

  • The raspi-pir command should be installed somewhere in your PATH (done automatically when installing via pip), make sure raspi-pir.service has corect path in ExecStart set to raspi-pir executable.

  • Systemd scripts are available: https://github.com/ricco386/RPi.PIR/tree/master/init.d to install them you will need root privileges, so we execute them as sudo:

    sudo cp init.d/raspi-pir.conf /etc/tmpfiles.d/
    sudo cp init.d/raspi-pir.service /etc/systemd/system/
    sudo systemd-tmpfiles --create /etc/tmpfiles.d/raspi-pir.conf
    sudo systemctl enable raspi-pir.service  # Enable service to start at system boot
    sudo systemctl start raspi-pir.service  # Start

Systemd scripts should be run under default Raspberry Pi user (pi), scripts have to be able access GPIO.

Dependencies:

Usage

You have to create a .sensor.cfg file and place into /home/pi/.sensor.cfg you can find example file in RPi.Sensor repo: https://github.com/ricco386/RPi.Sensor/blob/master/raspi_sensor/sensor.cfg.example and create section [PIR] where you can override default values.

raspi-pir also support parameters to overwrite config parameters. For more info run:

raspi-pir --help

Zabbix support

In directory zabbix_template there is a Zabbix template that can be imported to Zabbix and monitor systemd process if it is running and how much memory it consumes. It also supports Zabbix trapper rpi.pir-state that can receive a sensor state changes.

License

For more information see the LICENSE file.

Metadata

Release files for RPi.PIR 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RPi.PIR 0.5.0
File Size Uploaded
RPi.PIR-0.5.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for RPi.PIR 0.5.0
File Interpreter ABI Platform
RPi.PIR-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / RPi.PIR-0.5.0.tar.gz

Download URL RPi.PIR-0.5.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c6c7f21c2ba896826acf494a11b1639ab78d401abe051aea41c90f81904d5a9f
BLAKE2b-256 checksum
How to use checksums
c25aef97c398d8253ae152b299c15b68bb1c0985f0d88d78c26a844288a59027
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Release files / RPi.PIR-0.5.0-py3-none-any.whl

Download URL RPi.PIR-0.5.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
834b1cf1f518c81b5e8e2ae13def4b10289960e12f5c8fb62a55022e7455f83a
BLAKE2b-256 checksum
How to use checksums
7f8e8ff916ce79410031cb48550ff0bac677981300eabf83e67bf28c69cb5c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page