Skip to content

Commit

Permalink
Merge pull request #19008 from asdil12/shelly
Browse files Browse the repository at this point in the history
Be more verbose in power_on_off_shelly.sh
  • Loading branch information
kalikiana committed Apr 2, 2024
2 parents 8518ab7 + 80d77c3 commit ce98eb6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/generalhw_scripts/power_on_off_shelly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ fi
shelly_ip=$1
state=$2

echo "$0: Setting shelly $shelly_ip output $state"
res=$(curl -s "http://${shelly_ip}/relay/0?turn=${state}")
if ! echo "$res" | grep -q "ison" ; then
exit 1
fi
test "$state" == "on" && expected_ison="true"
test "$state" == "off" && expected_ison="false"
result_ison=$(echo "$res" | jq -c .ison)
if [ "$result_ison" != "$expected_ison" ] ; then
echo "Error: $0 expected state $expected_ison but got $result_ison"
exit 1
fi

0 comments on commit ce98eb6

Please sign in to comment.