projects
/
vaillant-thermostat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
filter out humidify < 10 from rtl433
[vaillant-thermostat]
/
serial.pl
diff --git
a/serial.pl
b/serial.pl
index
06a1d15
..
06197a0
100755
(executable)
--- a/
serial.pl
+++ b/
serial.pl
@@
-30,9
+30,9
@@
my $sym;
sub _mqtt_pub {
my ( $t, $m ) = @_;
sub _mqtt_pub {
my ( $t, $m ) = @_;
- my $cmd = "mosquitto_pub -h rpi2 -t '
stat/rpi/
$t' -m '$m'";
+ my $cmd = "mosquitto_pub -h rpi2 -t '$t' -m '$m'";
#warn "# _mqtt_pub [$t] = [$m]\n";
#warn "# _mqtt_pub [$t] = [$m]\n";
- warn "## $cmd";
+
#
warn "## $cmd";
system $cmd;
}
system $cmd;
}
@@
-45,8
+45,9
@@
while (1) {
my $hex = unpack('H*',$string);
$hex =~ s/(..)/$1 /g;
my $hex = unpack('H*',$string);
$hex =~ s/(..)/$1 /g;
- my $temp = `curl localhost:3000/temp.txt`;
+ my $temp = `curl
-q
localhost:3000/temp.txt`;
$temp =~ s/\s+/ /gs;
$temp =~ s/\s+/ /gs;
+ $temp =~ s/^\s+//;
#printf "%s %2d %s\n", time(), $len, $hex;
printf "%8.4f %6.2f %2d %s | %s\n", $ts, $ts - $t, $len, $hex, $temp;
#printf "%s %2d %s\n", time(), $len, $hex;
printf "%8.4f %6.2f %2d %s | %s\n", $ts, $ts - $t, $len, $hex, $temp;
@@
-67,6
+68,12
@@
while (1) {
_mqtt_pub "stat/boiler/" . chr(ord('a') + $_) => $d[$_] foreach 0 .. $#d;
}
_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 );
+ foreach (@v) {
+ _mqtt_pub "stat/boiler/" . shift(@n) => $_;
+ }
+
}
}
}
}