#!/bin/sh
for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do
for VALUE in `echo $QUERY | tr '=' ' '`; do
if [ "$VALUE" == "id" ]; then
ID='?'
elif [ "$ID" == "?" ]; then
ID=$VALUE
elif [ "$VALUE" == "power" ]; then
POWER='?'
elif [ "$POWER" == "?" ]; then
POWER=$VALUE
elif [ "$VALUE" == "ajax" ]; then
AJAX='?'
elif [ "$AJAX" == "?" ]; then
AJAX=$VALUE
fi
i=$i+1
done
done
UNIXSOCK=/var/run/powersensordaemon/cmd.sock
VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo idee deckehinten deckevorne"
VALID_SEND_IDS="ymhpoweron ymhpoweroff ymhpower ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunabcde ymhtape ymhvcr ymhextdec"
[ "$POWER" == "send" ] && POWER=on
if [ "$POWER" == "on" -o "$POWER" == "off" ]; then
for CHECKID in $VALID_ONOFF_IDS $VALID_SEND_IDS; do
if [ "$CHECKID" == "$ID" ]; then
echo "power $POWER $ID" | usocket $UNIXSOCK
echo "Content-type: text/html"
echo ""
echo ""
echo "
"
echo "Realraum rf433ctl"
echo ''
echo ""
exit 0
fi
done
fi
DESC_werkzeug="Werkzeug LEDs"
DESC_stereo="Reciever On/Off"
DESC_ambientlights="Ambient Lichter"
DESC_labor="Labor Licht"
DESC_dart="Dart Scheibe"
DESC_logo="Logo"
DESC_idee="Idee"
DESC_deckehinten="Decke Hinten"
DESC_deckevorne="Decke Vorne"
DESC_decke="Deckenlichter"
DESC_lichter="Alle Lichter"
DESC_all="Alles"
DESC_ymhpoweron="Reciever On"
DESC_ymhpoweroff="Reciever Off"
DESC_ymhpower="Reciever On/Off"
DESC_ymhvolup="VolumeUp"
DESC_ymhvoldown="VolumeDown"
DESC_ymhcd="Input CD"
DESC_ymhwdtv="Input WDlxTV"
DESC_ymhtuner="Input Tuner"
DESC_ymhvolmute="Mute"
DESC_ymhmenu="Menu"
DESC_ymhplus="+"
DESC_ymhminus="-"
DESC_ymhtest="Test"
DESC_ymhtimelevel="Time/Levels"
DESC_ymheffect="DSP Effect Toggle"
DESC_ymhprgup="DSP Up"
DESC_ymhprgdown="DSP Down"
DESC_ymhtunplus="Tuner +"
DESC_ymhtunabcde="Tuner ABCDE"
DESC_ymhtape="Tape"
DESC_ymhvcr="VCR"
DESC_ymhextdec="ExtDec Toggle"
echo "Content-type: text/html"
echo ""
echo ""
echo ""
echo "Realraum rf433ctl"
echo ''
echo ""
echo ""
#echo "Realraum rf433ctl
"
echo ""
for DISPID in $VALID_ONOFF_IDS; do
NAME="$(eval echo \$DESC_$DISPID)"
[ -z "$NAME" ] && NAME=$DISPID
if [ -z "$AJAX" ]; then
echo "
"
else
echo "
$NAME
"
echo " "
echo " "
echo ""
fi
done
echo "
"
echo ""
for DISPID in $VALID_SEND_IDS; do
NAME="$(eval echo \$DESC_$DISPID)"
[ -z "$NAME" ] && NAME=$DISPID
if [ -z "$AJAX" ]; then
echo "
"
else
echo "
$NAME
"
echo " "
echo ""
fi
done
echo "
"
echo ""
echo ""