Show pageOld revisionsBacklinksODT exportBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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**: <code bash> root@raspberry-pi:~# echo "14">/sys/class/gpio/export root@raspberry-pi:~# echo "out">/sys/class/gpio/gpio14/direction </code> ggF. ''voc'' user in ''gpio'' Gruppe setzen. <code bash> root@raspberry-pi:~# adduser voc gpio </code> ===== Automatic Trigger via MQTT ===== Prerequisites: AnyEvent and AnyEvent::MQTT: <code bash> 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 </code> Running: <code bash> cd mqtt/shell # reinstate local::lib if not already present in the current environment eval $(perl -Mlocal::lib) screen -S bot perl bot.pl </code> Es kann sein, dass perl z.B. Alert.pm nicht findet, Suchpfade dafür kann man folgendermaßen hinzufügen: <code bash> export PERL5LIB=[pfad] </code> Zum Filtern der Meldungen ''bot.pl'' anschauen und editieren. ===== Manual Trigger ===== <code bash> 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 </code> Oder ''shell/alert.pl'' / ''shell/alert.sh'' ===== Socket Trigger ===== **blink.sh** <code bash> 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 </code> **On the remote host** <code bash> socat -du TCP-LISTEN:9191,fork TCP-LISTEN:9192,range=127.0.0.1/32,reuseaddr </code> **On the Pi** <code bash> echo "14">/sys/class/gpio/export echo "out">/sys/class/gpio/gpio14/direction ./blink.sh foobarhost.c3voc.de </code> ** To trigger on the remote Host ** <code bash> nc -z localhost 9192 </code> hardware/viriwarninglamp.txt Last modified: 2020/12/10 01:47by andi