X-Git-Url: http://git.rot13.org/?p=mqtt-homehub;a=blobdiff_plain;f=mqtt-trend.pl;h=7047672462855f1c9bd944214701b1567c69c321;hp=e256a455654d3a20834cbec73cbcdfe64a69675c;hb=b528b57cc9ca1b58cb72a18e0af0c83f2b0071a9;hpb=75bf20352750207b90db5b9fe80dc74d283662a4 diff --git a/mqtt-trend.pl b/mqtt-trend.pl index e256a45..7047672 100755 --- a/mqtt-trend.pl +++ b/mqtt-trend.pl @@ -19,12 +19,15 @@ system "i3-msg layout splitv"; my $border = 2; -open(my $in, '-|', 'mosquitto_sub -h rpi2 -t stat/# -t fade/# -v'); +my $topic = 'fade/#'; +$topic = $ARGV[0] if $ARGV[0]; + +open(my $in, '-|', "mosquitto_sub -h rpi2 -t '$topic' -v"); while(<$in>) { s/\s+$//sg; my ($t,$v) = split(/\s/,$_,2); - warn "$t\t$v\n"; + print STDERR "$t=$v "; if ( ! exists $trend->{$t} && $v =~ m/^\d+/ ) { my $hist = $trend->{hist_spec}->{$t} || $trend->{hist_spec}->{__default};