From 59b28a41e509a3d933d3dac493ad78e60561e1d9 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 21 May 2021 17:11:30 +0200 Subject: [PATCH] turn debug on with: touch /dev/shm/air-debug --- dsm501.pl | 4 ++-- mh-z19b.pl | 2 +- pms3003.pl | 2 +- zph02.pl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dsm501.pl b/dsm501.pl index a821aaf..33277e5 100755 --- a/dsm501.pl +++ b/dsm501.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.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://10.60.0.92:8086/write?consistency=any&db=rot13'; my $measurement = $ENV{MEASUREMENT} || 'dsm501'; my $s = new Device::SerialPort( $port ) || die $!; @@ -31,7 +31,7 @@ while (1) { $string =~ s/[\r\n]+$//; $string =~ s/\s/,/g; my $influx = "$measurement,dc=trnjanska $string $t"; - print "$influx\n"; + print "$influx\n" if -e '/dev/shm/air-debug'; system "curl --silent -XPOST '$influx_url' --data-binary '$influx'" } else { warn "SKIP: $string\n"; diff --git a/mh-z19b.pl b/mh-z19b.pl index 9076414..927951b 100755 --- a/mh-z19b.pl +++ b/mh-z19b.pl @@ -43,7 +43,7 @@ while (1) { my $co2 = $v[2] * 255 + $v[3]; if ( $v[0] == 0xff && $sum == $checksum ) { my $influx = "mh-z19b,dc=trnjanska co2=$co2 $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/mh-z19b/co2' -m $co2"; } else { diff --git a/pms3003.pl b/pms3003.pl index c1708f6..cb68af2 100755 --- a/pms3003.pl +++ b/pms3003.pl @@ -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'" } } diff --git a/zph02.pl b/zph02.pl index 0a01d36..00d8c2d 100755 --- 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"; } -- 2.20.1