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" == "mobile" ]; then
16 elif [ "$VALUE" == "nofloat" ]; then
24 UNIXSOCK=/var/run/powersensordaemon/cmd.sock
25 VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo spots1 deckehinten deckevorne boiler whiteboard pcblueleds bikewcblue"
26 VALID_SEND_IDS_CUSTOM_DISPLAY="ymhpoweroff ymhpower ymhvolup ymhvoldown"
27 VALID_SEND_IDS="ymhpoweron 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"
28 #VALID_BANSHEE_IDS="playPause next prev"
29 #VALID_CAM_MOTOR_IDS="c C w W"
31 [ "$POWER" == "send" ] && POWER=on
32 if [ "$POWER" == "on" -o "$POWER" == "off" ]; then
33 for CHECKID in $VALID_ONOFF_IDS $VALID_SEND_IDS $VALID_SEND_IDS_CUSTOM_DISPLAY; do
34 if [ "$CHECKID" == "$ID" ]; then
35 echo "power $POWER $ID" | usocket $UNIXSOCK
36 echo "Content-type: text/html"
40 echo "<title>Realraum rf433ctl</title>"
41 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
47 for CHECKID in $VALID_BANSHEE_IDS; do
48 if [ "$CHECKID" == "$ID" ]; then
49 echo "$ID/" | nc wuerfel.realraum.at 8484
50 echo "Content-type: text/html"
54 echo "<title>Realraum rf433ctl</title>"
55 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
61 for CHECKID in $VALID_CAM_MOTOR_IDS; do
62 if [ "$CHECKID" == "$ID" ]; then
63 echo "$ID" > /dev/ttyACM0
64 echo "Content-type: text/html"
68 echo "<title>Realraum rf433ctl</title>"
69 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
76 DESC_pcblueleds="Blaue Leds PC"
77 DESC_bikewcblue="Blaue Lichterkette WC"
79 DESC_werkzeug="Werkzeug LEDs"
80 DESC_stereo="Receiver On/Off"
81 DESC_ambientlights="Ambient Lichter"
82 DESC_labor="Labor Licht"
83 DESC_boiler="Warmwasser WC"
84 DESC_dart="Dart Scheibe"
87 DESC_deckehinten="Decke Hinten"
88 DESC_deckevorne="Decke Vorne"
89 DESC_whiteboard="Whiteboard Vorne"
90 DESC_decke="Deckenlichter"
91 DESC_lichter="Alle Lichter"
93 DESC_ymhpoweron="Receiver On (off+tgl)"
94 DESC_ymhpoweroff="Receiver Off"
95 DESC_ymhpower="Receiver On/Off"
96 DESC_ymhvolup="VolumeUp"
97 DESC_ymhvoldown="VolumeDown"
99 DESC_ymhwdtv="Input S/PDIF Wuerfel"
100 DESC_ymhtuner="Input Tuner"
101 DESC_ymhvolmute="Mute"
106 DESC_ymhtimelevel="Time/Levels"
107 DESC_ymheffect="DSP Effect Toggle"
108 DESC_ymhprgup="DSP Up"
109 DESC_ymhprgdown="DSP Down"
110 DESC_ymhtunplus="Tuner +"
111 DESC_ymhtunminus="Tuner -"
112 DESC_ymhtunabcde="Tuner ABCDE"
115 DESC_ymhextdec="ExtDec Toggle"
116 DESC_seep="Sleep Modus"
117 DESC_panicled="HAL9000 says hi"
118 DESC_blueled="Blue Led"
119 DESC_moviemode="Movie Mode"
125 echo "Content-type: text/html"
129 echo "<title>Realraum rf433ctl</title>"
130 echo '<script type="text/javascript">'
131 echo 'function sendButton( onoff, btn )'
133 echo ' var req = new XMLHttpRequest();'
134 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
135 echo ' req.open("GET", url ,false);'
136 echo ' //google chrome workaround'
137 echo ' req.setRequestHeader("googlechromefix","");'
138 echo ' req.send(null);'
140 [ "$NOFLOAT" == "1" ] && tail -n+6 /www/ymhremote.html | head -n 58
142 [ "$NOFLOAT" == "1" ] && tail -n+67 /www/ymhremote.html | head -n 37
144 echo 'div.switchbox {'
147 #echo ' max-width:236px;'
148 echo ' max-width:300px;'
149 echo ' font-size:10pt;'
150 echo ' border:1px solid black;'
151 #echo ' height: 32px;'
155 echo 'div.switchnameleft {'
156 echo ' width:12em; display:inline-block; vertical-align:middle; margin-left:3px;'
159 echo 'span.alignbuttonsright {'
160 echo ' top:0px; float:right; display:inline-block; text-align:right; padding:0;'
163 echo 'div.switchnameright {'
164 echo ' width:12em; display:inline-block; vertical-align:middle; float:right; display:inline-block; margin-left:1ex; margin-right:3px; margin-top:3px; margin-bottom:3px;'
167 echo 'span.alignbuttonsleft {'
168 echo ' float:left; text-align:left; padding:0;'
172 echo ' font-size:11pt;'
174 echo ' height: 32px;'
175 echo ' background-color: lime;'
180 echo ' font-size:11pt;'
182 echo ' height: 32px;'
183 echo ' background-color: red;'
188 echo ' font-size:11pt;'
190 echo ' height: 32px;'
191 #echo ' background-color: grey;'
197 #echo "<h1>Realraum rf433ctl</h1>"
198 #echo "<div style=\"float:left; border:1px solid black;\">"
199 echo "<div style=\"float:left;\">"
200 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
201 for DISPID in $VALID_ONOFF_IDS; do
202 NAME="$(eval echo \$DESC_$DISPID)"
203 [ -z "$NAME" ] && NAME=$DISPID
205 echo "<div class=\"switchbox\">"
206 echo "<span class=\"alignbuttonsleft\">"
207 echo " <button class=\"onbutton\" onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
208 echo " <button class=\"offbutton\" onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
210 echo "<div class=\"switchnameright\">$NAME</div>"
213 if [ "$NOFLOAT" == "1" ]; then
218 #Custom Buttons Start
219 echo "<div class=\"switchbox\">"
220 echo "<span class=\"alignbuttonsleft\">"
221 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhpower\");'>Tgl</button>"
222 echo " <button class=\"offbutton\" onClick='sendButton(\"on\",\"ymhpoweroff\");'>Off</button>"
224 echo "<div class=\"switchnameright\">Receiver Power</div>"
226 if [ "$NOFLOAT" == "1" ]; then
229 echo "<div class=\"switchbox\">"
230 echo "<span class=\"alignbuttonsleft\">"
231 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvolup\");'>↑</button>"
232 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvoldown\");'>↓</button>"
234 echo "<div class=\"switchnameright\">Receiver Volume</div>"
236 if [ "$NOFLOAT" == "1" ]; then
243 if [ "$MOBILE" != "1" ]; then
245 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
249 for DISPID in $VALID_SEND_IDS; do
250 ITEMCOUNT=$((ITEMCOUNT+1))
251 NAME="$(eval echo \$DESC_$DISPID)"
252 [ -z "$NAME" ] && NAME=$DISPID
254 echo "<div class=\"switchbox\">"
255 echo "<span class=\"alignbuttonsleft\">"
256 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
258 echo "<div class=\"switchnameright\">$NAME</div>"
260 if [ "$NOFLOAT" == "1" -a $((ITEMCOUNT % 2 )) -ne 1 ]; then
265 echo '<div class="switchbox">Goto <a href="/ymhremote.html">Yamaha Receiver Remote</a></div>'
268 if [ "$NOFLOAT" == "1" ]; then
269 echo "<div style=\"float:left; border:1px solid black;\">"
270 tail -n+107 /www/ymhremote.html | head -n 5
274 echo "<div style=\"float:left; border:1px solid black; margin-top:5px;\">"
275 for DISPID in $VALID_BANSHEE_IDS $VALID_CAM_MOTOR_IDS; do
276 NAME="$(eval echo \$DESC_$DISPID)"
277 [ -z "$NAME" ] && NAME=$DISPID
279 echo "<div class=\"switchbox\">"
280 echo "<span class=\"alignbuttonsleft\">"
281 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
283 echo "<div class=\"switchnameright\">$NAME</div>"
285 if [ "$NOFLOAT" == "1" ]; then