[mystrom] add script for power cycling
This commit is contained in:
parent
c6d03c7735
commit
05233eac2a
1 changed files with 25 additions and 0 deletions
25
mystrom/mystrom-10soff-and-then-on.sh
Executable file
25
mystrom/mystrom-10soff-and-then-on.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# 2020-12-07, Nico Schottelius
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "$0 hostname [hostname...]"
|
||||||
|
echo " hostname: which mystrom to connect to"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ $# -ge 1 ]; do
|
||||||
|
hostname=$1; shift
|
||||||
|
|
||||||
|
http --json GET "http://${hostname}/report"
|
||||||
|
curl -s --location \
|
||||||
|
--request GET \
|
||||||
|
"http://${hostname}/relay?state=0"
|
||||||
|
http --json GET "http://${hostname}/report"
|
||||||
|
echo "Waiting..."
|
||||||
|
sleep 10
|
||||||
|
curl -s --location \
|
||||||
|
--request GET \
|
||||||
|
"http://${hostname}/relay?state=1"
|
||||||
|
http --json GET "http://${hostname}/report"
|
||||||
|
|
||||||
|
done
|
Loading…
Reference in a new issue