Viri Warning Lamp

The Viri Warning Lamp has all the electronics built in by now and comes with a nice Raspberry Pi GPIO plug:

https://c3voc.de/gallery/misc/voc-light/

GPIO Preparation

The yellow warning lamp runs on GPIO14:

root@raspberry-pi:~# echo "14">/sys/class/gpio/export root@raspberry-pi:~# echo "out">/sys/class/gpio/gpio14/direction

ggF. voc user in gpio Gruppe setzen.

root@raspberry-pi:~# adduser voc gpio

Automatic Trigger via MQTT

Prerequisites: AnyEvent and AnyEvent::MQTT:

sudo apt-get install libanyevent-perl liblocal-lib-perl cpanminus eval $(perl -Mlocal::lib) cpanm AnyEvent::MQTT # get VOC mqtt tools git clone git@c3voc.de:mqtt

Running:

cd mqtt/shell # reinstate local::lib if not already present in the current environment eval $(perl -Mlocal::lib) screen -S bot perl bot.pl

Es kann sein, dass perl z.B. Alert.pm nicht findet, Suchpfade dafür kann man folgendermaßen hinzufügen:

export PERL5LIB=[pfad]

Zum Filtern der Meldungen bot.pl anschauen und editieren.

Manual Trigger

root@raspberry-pi:~# echo "1">/sys/class/gpio/gpio14/value root@raspberry-pi:~# echo "0">/sys/class/gpio/gpio14/value root@raspberry-pi:~# echo "1">/sys/class/gpio/gpio14/value root@raspberry-pi:~# echo "0">/sys/class/gpio/gpio14/value

Oder shell/alert.pl / shell/alert.sh

Socket Trigger

blink.sh

while [ true ] do sleep 0.3 echo $1 `nc $1 9191` || { continue; } echo blink echo "1">/sys/class/gpio/gpio14/value sleep 1.5 echo "0">/sys/class/gpio/gpio14/value done

On the remote host

socat -du TCP-LISTEN:9191,fork TCP-LISTEN:9192,range=127.0.0.1/32,reuseaddr

On the Pi

echo "14">/sys/class/gpio/export echo "out">/sys/class/gpio/gpio14/direction ./blink.sh foobarhost.c3voc.de

To trigger on the remote Host

nc -z localhost 9192