example for sonoff
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 28 Jul 2019 11:51:54 +0000 (13:51 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 28 Jul 2019 11:51:54 +0000 (13:51 +0200)
sonoff.sh [new file with mode: 0755]

diff --git a/sonoff.sh b/sonoff.sh
new file mode 100755 (executable)
index 0000000..c73d4f6
--- /dev/null
+++ b/sonoff.sh
@@ -0,0 +1,5 @@
+#!/bin/sh -xe
+test -z "$1" && echo "usage: $0 light|ledstate on|off" && exit 1
+device=`basename $0 | cut -d. -f1`
+mosquitto_pub -h rpi2 -t "cmnd/$device/$1" -m "$2"
+