From 05233eac2af2ead72d4276aff11e0206bd8efc9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 23 Jul 2023 09:32:56 +0200 Subject: [PATCH] [mystrom] add script for power cycling --- mystrom/mystrom-10soff-and-then-on.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 mystrom/mystrom-10soff-and-then-on.sh diff --git a/mystrom/mystrom-10soff-and-then-on.sh b/mystrom/mystrom-10soff-and-then-on.sh new file mode 100755 index 0000000..1231c6e --- /dev/null +++ b/mystrom/mystrom-10soff-and-then-on.sh @@ -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