Commit d4a28959 authored by Daniel Stan's avatar Daniel Stan

toggle: force mode

parent adbfb438
......@@ -9,6 +9,15 @@ TMPDIR=/tmp/relaystates
mkdir -p $TMPDIR
relay=$(echo "$1" | sed "s/[^0-9]//g")
onfile=$TMPDIR/$relay-on
if [ "$2" = "forceon" ]; then
action=on
elif [ "$2" = "forceoff" ]; then
action=off
elif [ -f $onfile ]; then
action=off
else
action=on
fi
send() {
# $1 = numéro de relai, $2 = on or off
......@@ -23,7 +32,7 @@ send() {
fi
}
if [ -f $onfile ]; then
if [ "$action" = "off" ]; then
send $relay off
rm $onfile
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment