Merge branch 'master' of mjesec.ffzg.hr:/git/air-quality
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Jan 2020 11:45:43 +0000 (12:45 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Jan 2020 11:45:43 +0000 (12:45 +0100)
audio2mqtt.sh [new file with mode: 0755]
zph02.pl

diff --git a/audio2mqtt.sh b/audio2mqtt.sh
new file mode 100755 (executable)
index 0000000..af23cbb
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+while true ; do
+
+arecord -d 1 -r 96000 /dev/shm/tmp.wav
+time=`date +'%s%N'`
+info=`sox /dev/shm/tmp.wav -n stat 2>&1 | grep '[0-9][0-9][0-9]*$' | sed -e 's/[()]//g' -e 's/: */=/' -e 's/  */_/g' | tr '\n' ',' | sed 's/[, ]*$//'`
+curl --silent -XPOST http://10.60.0.92:8086/write?db=rot13 --data-binary "fan,dc=trnjanska $info $time"
+
+done
index d0797d9..aeaaffb 100755 (executable)
--- a/zph02.pl
+++ b/zph02.pl
@@ -6,7 +6,8 @@ use Device::SerialPort;
 use Time::HiRes;
 use Data::Dump qw(dump);
 
-my $port = shift @ARGV || '/dev/ttyUSB0';
+my $port = shift @ARGV || '/dev/ttyUSB1';
+$port = '/dev/serial/by-path/pci-0000:00:1a.7-usb-0:5.4:1.0-port0';
 my $influx_url = shift @ARGV || 'http://10.13.37.229:8186/write?db=telegraf';
 $influx_url = 'http://10.13.37.92:8086/write?db=rot13';