convert ir-ctl -r output into sigrok file for pulseview
[mqtt-homehub] / mqtt-trend.pl
index e256a45..7047672 100755 (executable)
@@ -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};