turn debug on with: touch /dev/shm/air-debug
[air-quality] / zph02.pl
index 0a01d36..00d8c2d 100755 (executable)
--- a/zph02.pl
+++ b/zph02.pl
@@ -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";
                }