request status from all tasmota firmwares
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 28 Jul 2019 14:15:02 +0000 (16:15 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 28 Jul 2019 14:15:02 +0000 (16:15 +0200)
mqtt-tasmota.sh [new file with mode: 0755]

diff --git a/mqtt-tasmota.sh b/mqtt-tasmota.sh
new file mode 100755 (executable)
index 0000000..598394f
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -xe
+
+mqtt="-h rpi2"
+
+cmnd=$1
+test -z "$cmnd" && cmnd="status"
+
+trap "trap - TERM && kill -- -$$" INT TERM EXIT
+
+mosquitto_sub $mqtt -t "stat/#" -v | tee /dev/shm/mqtt.$cmnd &
+
+mosquitto_pub $mqtt -t "cmnd/sonoffs/$cmnd" -m 0
+sleep 1