3 for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do
4 for VALUE in `echo $QUERY | tr '=' ' '`; do
5 if [ "$VALUE" == "id" ]; then
7 elif [ "$ID" == "?" ]; then
9 elif [ "$VALUE" == "power" ]; then
11 elif [ "$POWER" == "?" ]; then
13 elif [ "$VALUE" == "ajax" ]; then
15 elif [ "$AJAX" == "?" ]; then
22 UNIXSOCK=/var/run/powersensordaemon/cmd.sock
23 VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo spots1 deckehinten deckevorne boiler"
24 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"
25 VALID_BANSHEE_IDS="playPause next prev"
27 [ "$POWER" == "send" ] && POWER=on
28 if [ "$POWER" == "on" -o "$POWER" == "off" ]; then
29 for CHECKID in $VALID_ONOFF_IDS $VALID_SEND_IDS; do
30 if [ "$CHECKID" == "$ID" ]; then
31 echo "power $POWER $ID" | usocket $UNIXSOCK
32 echo "Content-type: text/html"
36 echo "<title>Realraum rf433ctl</title>"
37 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
43 for CHECKID in $VALID_BANSHEE_IDS; do
44 if [ "$CHECKID" == "$ID" ]; then
45 echo "$ID/" | nc wuerfel.realraum.at 8484
46 echo "Content-type: text/html"
50 echo "<title>Realraum rf433ctl</title>"
51 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
58 DESC_werkzeug="Werkzeug LEDs"
59 DESC_stereo="Receiver On/Off"
60 DESC_ambientlights="Ambient Lichter"
61 DESC_labor="Labor Licht"
62 DESC_boiler="Warmwasser WC"
63 DESC_dart="Dart Scheibe"
66 DESC_deckehinten="Decke Hinten"
67 DESC_deckevorne="Decke Vorne"
68 DESC_decke="Deckenlichter"
69 DESC_lichter="Alle Lichter"
71 DESC_ymhpoweron="Receiver On"
72 DESC_ymhpoweroff="Receiver Off"
73 DESC_ymhpower="Receiver On/Off"
74 DESC_ymhvolup="VolumeUp"
75 DESC_ymhvoldown="VolumeDown"
77 DESC_ymhwdtv="Input WDlxTV"
78 DESC_ymhtuner="Input Tuner"
79 DESC_ymhvolmute="Mute"
84 DESC_ymhtimelevel="Time/Levels"
85 DESC_ymheffect="DSP Effect Toggle"
86 DESC_ymhprgup="DSP Up"
87 DESC_ymhprgdown="DSP Down"
88 DESC_ymhtunplus="Tuner +"
89 DESC_ymhtunminus="Tuner -"
90 DESC_ymhtunabcde="Tuner ABCDE"
93 DESC_ymhextdec="ExtDec Toggle"
94 DESC_seep="Sleep Modus"
95 DESC_panicled="HAL9000 says hi"
96 DESC_blueled="Blue Led"
97 DESC_moviemode="Movie Mode"
98 echo "Content-type: text/html"
102 echo "<title>Realraum rf433ctl</title>"
103 echo '<script type="text/javascript">'
104 echo 'function sendButton( onoff, btn )'
106 echo ' var req = new XMLHttpRequest();'
107 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
108 echo ' req.open("GET", url ,false);'
109 echo ' //google chrome workaround'
110 echo ' req.setRequestHeader("googlechromefix","");'
111 echo ' req.send(null);'
116 #echo "<h1>Realraum rf433ctl</h1>"
117 echo "<div style=\"float:left; border:1px solid black;\">"
118 for DISPID in $VALID_ONOFF_IDS; do
119 NAME="$(eval echo \$DESC_$DISPID)"
120 [ -z "$NAME" ] && NAME=$DISPID
121 if [ -z "$AJAX" ]; then
123 echo "<form action=\"/cgi-bin/switch.cgi\">"
124 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
125 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
126 echo " <input type='submit' name='power' value='on' />"
127 echo " <input type='submit' name='power' value='off' />"
133 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
134 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
135 echo " <button onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
141 echo "<div style=\"float:left; border:1px solid black;\">"
142 for DISPID in $VALID_SEND_IDS; do
143 NAME="$(eval echo \$DESC_$DISPID)"
144 [ -z "$NAME" ] && NAME=$DISPID
145 if [ -z "$AJAX" ]; then
147 echo "<form action=\"/cgi-bin/switch.cgi\">"
148 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
149 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
150 echo " <input type='submit' name='power' value='send' />"
156 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
157 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>Send</button>"
163 echo "<div style=\"float:left; border:1px solid black;\">"
164 for DISPID in $VALID_BANSHEE_IDS; do
165 NAME="$(eval echo \$DESC_$DISPID)"
166 [ -z "$NAME" ] && NAME=$DISPID
167 if [ -z "$AJAX" ]; then
169 echo "<form action=\"/cgi-bin/switch.cgi\">"
170 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
171 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
172 echo " <input type='submit' name='power' value='on' />"
173 echo " <input type='submit' name='power' value='off' />"
179 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
180 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>Send</button>"