X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=serial.pl;h=c08a73e1397514479fd3ef093abe0f6e74ab33a0;hb=720c72fa7b481a1b1e2145491274f897749bb19e;hp=06197a0e1ee4945f73d302d2e8ce394eb7b089a8;hpb=a0469f519434a9d9dc03e6d84589777c009b3a96;p=vaillant-thermostat diff --git a/serial.pl b/serial.pl index 06197a0..c08a73e 100755 --- a/serial.pl +++ b/serial.pl @@ -7,7 +7,7 @@ use Time::HiRes qw(time); my $read_len = 255; -my $path = shift @ARGV || '/dev/serial/by-path/platform-20980000.usb-usb-0:1.3.1:1.0-port0'; +my $path = shift @ARGV || '/dev/serial/by-path/platform-20980000.usb-usb-0:1.2:1.0-port0'; $|=1; @@ -45,7 +45,7 @@ while (1) { my $hex = unpack('H*',$string); $hex =~ s/(..)/$1 /g; - my $temp = `curl -q localhost:3000/temp.txt`; + my $temp = `curl --silent localhost:3000/temp.txt`; $temp =~ s/\s+/ /gs; $temp =~ s/^\s+//; @@ -68,8 +68,9 @@ while (1) { _mqtt_pub "stat/boiler/" . chr(ord('a') + $_) => $d[$_] foreach 0 .. $#d; } - my @v = split(/\s+/, $temp, 3); - my @n = qw( DS18B20/temperature DHT22/temperature DHT22/humidity ); + my @v = split(/\s+/, $temp, 4); + my @n = qw( DS18B20/temperature DHT22/temperature DHT22/humidity DHT22/errors ); + @n = qw( DS18B20/temperature DHT22/temperature DHT22/humidity DHT22/errors ) if $#v == 1; # no DS18B20 foreach (@v) { _mqtt_pub "stat/boiler/" . shift(@n) => $_; }