Python script/daemon to read RPi PiFace inputs and run a webhook (or other callback) when they change.
This package is made up of two components; the listner and the worker. Each one has a separate console
entry point, and is intended to be run as a separate process/daemon. The listener (
listens to input pin change events from the PiFace, and creates files on disk (a simple disk-based queue)
for every event. The worker (
piface-worker) finds these new files, and executes the configured tasks
for each event, in order.
apt-get update && apt-get install -y puppet git
cd /usr/local && git clone https://github.com/jantman/piface-webhooks.git && cd piface-webhooks
./support/puppetize.sh- this will use Puppet to install the system-wide dependencies and setup the project. If you don't want to use Puppet, the script and Puppet manifests are commented (to reproduce their actions manually, if you want). Note that I had some problems on my test system with
virtualenvnot installing. If you experience failures,
apt-get install -y virtualenvand then run
- Configure per the instructions below.
systemctl restart piface-listener; systemctl restart piface-workerto reload the new configuration.
If you want to pass options to the scripts, you can do so by editing
and placing in the content of the file,
PIFACE_LISTENER_OPTS="<command line options here>" or
PIFACE_WORKER_OPTS="<command line options here>".
All components of piface-webhooks get their configuration from a Python module. For the simplest case (where you git cloned this repository),
piface_webhooks/settings.py and edit the settings to your liking; descriptions of them
and what they do are in comments. If you wish to keep your settings outside of the git repository, you can use any importable Python module;
simply export the name of the module as the
PIFACE_WEBHOOKS_SETTINGS_MODULE environment variable (inspired by django settings).
Simple Test/Foreground Operation
- In one shell/terminal, run
piface-listener -vv(debug-level output).
- In another, run
piface-worker -vv(debug-level output).
- Generate some input events, and watch it work.