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 lichterkette"
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_lichterkette="Blaue Lichterkette"
69 DESC_decke="Deckenlichter"
70 DESC_lichter="Alle Lichter"
72 DESC_ymhpoweron="Receiver On"
73 DESC_ymhpoweroff="Receiver Off"
74 DESC_ymhpower="Receiver On/Off"
75 DESC_ymhvolup="VolumeUp"
76 DESC_ymhvoldown="VolumeDown"
78 DESC_ymhwdtv="Input WDlxTV"
79 DESC_ymhtuner="Input Tuner"
80 DESC_ymhvolmute="Mute"
85 DESC_ymhtimelevel="Time/Levels"
86 DESC_ymheffect="DSP Effect Toggle"
87 DESC_ymhprgup="DSP Up"
88 DESC_ymhprgdown="DSP Down"
89 DESC_ymhtunplus="Tuner +"
90 DESC_ymhtunminus="Tuner -"
91 DESC_ymhtunabcde="Tuner ABCDE"
94 DESC_ymhextdec="ExtDec Toggle"
95 DESC_seep="Sleep Modus"
96 DESC_panicled="HAL9000 says hi"
97 DESC_blueled="Blue Led"
98 DESC_moviemode="Movie Mode"
99 echo "Content-type: text/html"
103 echo "<title>Realraum rf433ctl</title>"
104 echo '<script type="text/javascript">'
105 echo 'function sendButton( onoff, btn )'
107 echo ' var req = new XMLHttpRequest();'
108 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
109 echo ' req.open("GET", url ,false);'
110 echo ' //google chrome workaround'
111 echo ' req.setRequestHeader("googlechromefix","");'
112 echo ' req.send(null);'
117 #echo "<h1>Realraum rf433ctl</h1>"
118 echo "<div style=\"float:left; border:1px solid black;\">"
119 for DISPID in $VALID_ONOFF_IDS; do
120 NAME="$(eval echo \$DESC_$DISPID)"
121 [ -z "$NAME" ] && NAME=$DISPID
122 if [ -z "$AJAX" ]; then
124 echo "<form action=\"/cgi-bin/switch.cgi\">"
125 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
126 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;'>"
127 echo " <input type='submit' name='power' value='on' />"
128 echo " <input type='submit' name='power' value='off' />"
134 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;'>"
135 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
136 echo " <button onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
142 echo "<div style=\"float:left; border:1px solid black;\">"
143 for DISPID in $VALID_SEND_IDS; do
144 NAME="$(eval echo \$DESC_$DISPID)"
145 [ -z "$NAME" ] && NAME=$DISPID
146 if [ -z "$AJAX" ]; then
148 echo "<form action=\"/cgi-bin/switch.cgi\">"
149 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
150 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;'>"
151 echo " <input type='submit' name='power' value='send' />"
157 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;'>"
158 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>Send</button>"
164 echo "<div style=\"float:left; border:1px solid black;\">"
165 for DISPID in $VALID_BANSHEE_IDS; do
166 NAME="$(eval echo \$DESC_$DISPID)"
167 [ -z "$NAME" ] && NAME=$DISPID
168 if [ -z "$AJAX" ]; then
170 echo "<form action=\"/cgi-bin/switch.cgi\">"
171 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
172 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;'>"
173 echo " <input type='submit' name='power' value='on' />"
174 echo " <input type='submit' name='power' value='off' />"
180 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;'>"
181 echo " <button onClick='sendButton(\"on\",\"$DISPID\");'>Send</button>"