request status from all tasmota firmwares
[mqtt-homehub] / mqtt-tasmota.sh
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