#!/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 spots1 deckehinten deckevorne boiler"
VALID_SEND_IDS="ymhpoweron ymhpoweroff ymhpower ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner ymhaux ymhsattv ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunminus ymhtunabcde ymhtape ymhvcr ymhextdec ymhsleep ymhp5 panicled blueled moviemode"
VALID_BANSHEE_IDS="playPause next prev"
[ "$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
for CHECKID in $VALID_BANSHEE_IDS; do
if [ "$CHECKID" == "$ID" ]; then
echo "$ID/" | nc wuerfel.realraum.at 8484
echo "Content-type: text/html"
echo ""
echo ""
echo ""
echo "Realraum rf433ctl"
echo ''
echo ""
exit 0
fi
done
fi
DESC_werkzeug="Werkzeug LEDs"
DESC_stereo="Receiver On/Off"
DESC_ambientlights="Ambient Lichter"
DESC_labor="Labor Licht"
DESC_boiler="Warmwasser WC"
DESC_dart="Dart Scheibe"
DESC_logo="Logo"
DESC_spots1="Spots"
DESC_deckehinten="Decke Hinten"
DESC_deckevorne="Decke Vorne"
DESC_decke="Deckenlichter"
DESC_lichter="Alle Lichter"
DESC_all="Alles"
DESC_ymhpoweron="Receiver On"
DESC_ymhpoweroff="Receiver Off"
DESC_ymhpower="Receiver 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_ymhtunminus="Tuner -"
DESC_ymhtunabcde="Tuner ABCDE"
DESC_ymhtape="Tape"
DESC_ymhvcr="VCR"
DESC_ymhextdec="ExtDec Toggle"
DESC_seep="Sleep Modus"
DESC_panicled="HAL9000 says hi"
DESC_blueled="Blue Led"
DESC_moviemode="Movie Mode"
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 ""
for DISPID in $VALID_BANSHEE_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 ""