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="regalleinwand labortisch bluebar couchred couchwhite all lichter ambientlights mashatable mashadecke boiler"
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_regalleinwand="LEDs Regal Leinwand"
77 DESC_bluebar="Blaue LEDs Bar"
78 DESC_labortisch="Labortisch"
79 DESC_couchred="LEDs Couch Red"
80 DESC_couchwhite="LEDS Couch White"
81 DESC_mashatable="MaSha Tablelamp"
82 DESC_ambientlights="Ambient Lichter"
83 DESC_boiler="Warmwasser Küche"
84 DESC_lichter="Alle Lichter"
86 DESC_ymhpoweron="Receiver On (off+tgl)"
87 DESC_ymhpoweroff="Receiver Off"
88 DESC_ymhpower="Receiver On/Off"
89 DESC_ymhvolup="VolumeUp"
90 DESC_ymhvoldown="VolumeDown"
92 DESC_ymhwdtv="Input S/PDIF Wuerfel"
93 DESC_ymhtuner="Input Tuner"
94 DESC_ymhvolmute="Mute"
99 DESC_ymhtimelevel="Time/Levels"
100 DESC_ymheffect="DSP Effect Toggle"
101 DESC_ymhprgup="DSP Up"
102 DESC_ymhprgdown="DSP Down"
103 DESC_ymhtunplus="Tuner +"
104 DESC_ymhtunminus="Tuner -"
105 DESC_ymhtunabcde="Tuner ABCDE"
108 DESC_ymhextdec="ExtDec Toggle"
109 DESC_seep="Sleep Modus"
110 DESC_panicled="HAL9000 says hi"
111 DESC_blueled="Blue Led"
112 DESC_moviemode="Movie Mode"
118 echo "Content-type: text/html"
122 echo "<title>Realraum rf433ctl</title>"
123 echo '<script type="text/javascript">'
124 echo 'function sendButton( onoff, btn )'
126 echo ' var req = new XMLHttpRequest();'
127 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
128 echo ' req.open("GET", url ,false);'
129 echo ' //google chrome workaround'
130 echo ' req.setRequestHeader("googlechromefix","");'
131 echo ' req.send(null);'
133 [ "$NOFLOAT" == "1" ] && tail -n+6 /www/ymhremote.html | head -n 58
135 [ "$NOFLOAT" == "1" ] && tail -n+67 /www/ymhremote.html | head -n 37
137 echo 'div.switchbox {'
140 #echo ' max-width:236px;'
141 echo ' max-width:300px;'
142 echo ' font-size:10pt;'
143 echo ' border:1px solid black;'
144 #echo ' height: 32px;'
148 echo 'div.switchnameleft {'
149 echo ' width:12em; display:inline-block; vertical-align:middle; margin-left:3px;'
152 echo 'span.alignbuttonsright {'
153 echo ' top:0px; float:right; display:inline-block; text-align:right; padding:0;'
156 echo 'div.switchnameright {'
157 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;'
160 echo 'span.alignbuttonsleft {'
161 echo ' float:left; text-align:left; padding:0;'
165 echo ' font-size:11pt;'
167 echo ' height: 32px;'
168 echo ' background-color: lime;'
173 echo ' font-size:11pt;'
175 echo ' height: 32px;'
176 echo ' background-color: red;'
181 echo ' font-size:11pt;'
183 echo ' height: 32px;'
184 #echo ' background-color: grey;'
190 #echo "<h1>Realraum rf433ctl</h1>"
191 #echo "<div style=\"float:left; border:1px solid black;\">"
192 echo "<div style=\"float:left;\">"
193 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
194 for DISPID in $VALID_ONOFF_IDS; do
195 NAME="$(eval echo \$DESC_$DISPID)"
196 [ -z "$NAME" ] && NAME=$DISPID
198 echo "<div class=\"switchbox\">"
199 echo "<span class=\"alignbuttonsleft\">"
200 echo " <button class=\"onbutton\" onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
201 echo " <button class=\"offbutton\" onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
203 echo "<div class=\"switchnameright\">$NAME</div>"
206 if [ "$NOFLOAT" == "1" ]; then
211 #Custom Buttons Start
212 echo "<div class=\"switchbox\">"
213 echo "<span class=\"alignbuttonsleft\">"
214 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhpower\");'>Tgl</button>"
215 echo " <button class=\"offbutton\" onClick='sendButton(\"on\",\"ymhpoweroff\");'>Off</button>"
217 echo "<div class=\"switchnameright\">Receiver Power</div>"
219 if [ "$NOFLOAT" == "1" ]; then
222 echo "<div class=\"switchbox\">"
223 echo "<span class=\"alignbuttonsleft\">"
224 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvolup\");'>↑</button>"
225 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvoldown\");'>↓</button>"
227 echo "<div class=\"switchnameright\">Receiver Volume</div>"
229 if [ "$NOFLOAT" == "1" ]; then
236 if [ "$MOBILE" != "1" ]; then
238 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
242 for DISPID in $VALID_SEND_IDS; do
243 ITEMCOUNT=$((ITEMCOUNT+1))
244 NAME="$(eval echo \$DESC_$DISPID)"
245 [ -z "$NAME" ] && NAME=$DISPID
247 echo "<div class=\"switchbox\">"
248 echo "<span class=\"alignbuttonsleft\">"
249 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
251 echo "<div class=\"switchnameright\">$NAME</div>"
253 if [ "$NOFLOAT" == "1" -a $((ITEMCOUNT % 2 )) -ne 1 ]; then
258 echo '<div class="switchbox">Goto <a href="/ymhremote.html">Yamaha Receiver Remote</a></div>'
261 if [ "$NOFLOAT" == "1" ]; then
262 echo "<div style=\"float:left; border:1px solid black;\">"
263 tail -n+107 /www/ymhremote.html | head -n 5
267 echo "<div style=\"float:left; border:1px solid black; margin-top:5px;\">"
268 for DISPID in $VALID_BANSHEE_IDS $VALID_CAM_MOTOR_IDS; do
269 NAME="$(eval echo \$DESC_$DISPID)"
270 [ -z "$NAME" ] && NAME=$DISPID
272 echo "<div class=\"switchbox\">"
273 echo "<span class=\"alignbuttonsleft\">"
274 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
276 echo "<div class=\"switchnameright\">$NAME</div>"
278 if [ "$NOFLOAT" == "1" ]; then