don't send 0 values
[air-quality] / pms3003.pl
index f1d458a..e90d1c0 100755 (executable)
@@ -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.3:1.0-port0';
-my $influx_url = shift @ARGV || 'http://10.13.37.92:8086/write?consistency=any&db=rot13';
+my $influx_url = shift @ARGV || 'http://192.168.3.40:8086/write?consistency=any&db=rot13';
 
 my $debug = $ENV{DEBUG} || 0;
 
@@ -59,7 +59,7 @@ while (1) {
                        };
                        $influx =~ s/,$//;
                        $influx .= " $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'"
                }
        }