X-Git-Url: http://git.rot13.org/?p=air-quality;a=blobdiff_plain;f=zph02.pl;h=00d8c2d5a95830f0036125a298e74486b9099c91;hp=8b7018a2fd79c190f885f0d52a303e0259eb252b;hb=59b28a41e509a3d933d3dac493ad78e60561e1d9;hpb=c2240722beacb995b93da993a446348f8571f23d diff --git a/zph02.pl b/zph02.pl index 8b7018a..00d8c2d 100755 --- a/zph02.pl +++ b/zph02.pl @@ -7,7 +7,7 @@ use Time::HiRes; use Data::Dump qw(dump); my $port = shift @ARGV || '/dev/serial/by-path/platform-3f980000.usb-usb-0:1.5:1.0'; -my $influx_url = shift @ARGV || 'http://10.13.37.92:8086/write?consistency=any&db=rot13'; +my $influx_url = shift @ARGV || 'http://10.60.0.92:8086/write?consistency=any&db=rot13'; my $s = new Device::SerialPort( $port ) || die $!; $s->baudrate(9600); @@ -45,7 +45,7 @@ while (1) { my $pcnt = $v[3] + ( $v[4] / 100 ); if ( $v[0] == 0xff && $sum == $checksum ) { my $influx = "zph02,dc=trnjanska pm25_pcnt=$pcnt $t"; - print "$influx\n"; + print "$influx\n" if -e '/dev/shm/air-debug'; system "curl --max-time 2 --silent -XPOST '$influx_url' --data-binary '$influx'"; system "mosquitto_pub -h rpi2 -t 'air/zph02/pm25' -m $pcnt"; }