projects
/
mqtt-homehub
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
75bf203
)
specify topic on command-line
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 7 Aug 2017 13:06:51 +0000
(15:06 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 7 Aug 2017 13:06:51 +0000
(15:06 +0200)
mqtt-trend.pl
patch
|
blob
|
history
diff --git
a/mqtt-trend.pl
b/mqtt-trend.pl
index
e256a45
..
7047672
100755
(executable)
--- a/
mqtt-trend.pl
+++ b/
mqtt-trend.pl
@@
-19,12
+19,15
@@
system "i3-msg layout splitv";
my $border = 2;
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);
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};
if ( ! exists $trend->{$t} && $v =~ m/^\d+/ ) {
my $hist = $trend->{hist_spec}->{$t} || $trend->{hist_spec}->{__default};