X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=zph02.pl;h=44d35ef0e592029baa3353baa191e8f900dcc2c1;hb=ef3a3b7fe0a17b25386c642c921591edcf5018d4;hp=ef547656c7f5a74412a6a2b2d504555124d66f45;hpb=632fc9b95bf751f33b6d71238adc6bb94f2e5ae6;p=air-quality diff --git a/zph02.pl b/zph02.pl index ef54765..44d35ef 100755 --- a/zph02.pl +++ b/zph02.pl @@ -6,9 +6,8 @@ use Device::SerialPort; use Time::HiRes; use Data::Dump qw(dump); -my $port = shift @ARGV || '/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'; +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 $!; $s->baudrate(9600); @@ -47,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 --silent -XPOST '$influx_url' --data-binary '$influx'"; + system "mosquitto_pub -h rpi2 -t 'air/zph02/pm25' -m $pcnt"; } }