X-Git-Url: http://git.rot13.org/?p=air-quality;a=blobdiff_plain;f=zph02.pl;h=8b7018a2fd79c190f885f0d52a303e0259eb252b;hp=a6407fad11d671f8cf5f6201bf3eb0a425649de5;hb=c2240722beacb995b93da993a446348f8571f23d;hpb=c9bd23bbf3f7abefcc2f766ae8edf8a64d3570a4 diff --git a/zph02.pl b/zph02.pl index a6407fa..8b7018a 100755 --- a/zph02.pl +++ b/zph02.pl @@ -6,7 +6,7 @@ use Device::SerialPort; use Time::HiRes; use Data::Dump qw(dump); -my $port = shift @ARGV || '/dev/serial/by-path/platform-3f980000.usb-usb-0:1.4.2:1.0'; +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 $s = new Device::SerialPort( $port ) || die $!; @@ -46,7 +46,8 @@ while (1) { if ( $v[0] == 0xff && $sum == $checksum ) { my $influx = "zph02,dc=trnjanska pm25_pcnt=$pcnt $t"; print "$influx\n"; - system "curl --silent -XPOST '$influx_url' --data-binary '$influx'" + system "curl --max-time 2 --silent -XPOST '$influx_url' --data-binary '$influx'"; + system "mosquitto_pub -h rpi2 -t 'air/zph02/pm25' -m $pcnt"; } }