Mercurial > code > home > repos > homeauto
annotate service/garageArduino/index.html @ 4:be855a111619
move a bunch of services into this tree, give them all web status pages
Ignore-this: a11e90f9d2cd9470565c743f54943c4b
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 Aug 2011 00:31:31 -0700 |
parents | 6fd208b97616 |
children | 4c44c80a6a72 |
rev | line source |
---|---|
0 | 1 <?xml version="1.0" encoding="iso-8859-1"?> |
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
4 <html xmlns="http://www.w3.org/1999/xhtml"> | |
5 <head> | |
6 <title>garageArduino</title> | |
7 <link rel="alternate" type="application/x-trig" title="RDF graph" href="graph" /> | |
8 <style type="text/css" media="all"> | |
9 /* <![CDATA[ */ | |
10 .val { | |
11 font-weight: bold; | |
12 } | |
13 /* ]]> */ | |
14 </style> | |
15 </head> | |
16 <body> | |
17 | |
18 <h1>garageArduino service</h1> | |
19 | |
20 <p>Talking to an arduino uno on host <tt>slash</tt></p> | |
21 | |
22 <p><a href="http://octopart.com/555-28027-parallax-708653">PIR sensor</a> (in <a href="http://octopart.com/1551ggy-hammond-15686">a box</a>) measuring front door motion: <span class="val" id="frontDoorMotion"/></p> | |
23 | |
24 <p><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&productId=2006414&catalogId=10001&freeText=2006414&app.products.maxperpage=15&storeId=10001&search_type=jamecoall&ddkey=http:StoreCatalogDrillDownView">phototransistor</a> watching IR pulses on the power meter: last pulse was <span class="val" id="lastPulseAgo"/>; current power usage is <span class="val"><span id="currentWatts"/> watts</span> (assuming <span class="val" id="kwhPerBlink"/> kwh/blink)</p> | |
25 | |
4
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
26 <p>Recent raw IR sensor data: <div><img src="" id="raw"/></div></p> |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
27 |
0 | 28 <p><button type="submit" id="refresh">refresh</button></p> |
29 | |
30 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"/> | |
4
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
31 |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
32 |
0 | 33 <script type="text/javascript"> |
34 // <![CDATA[ | |
35 $(function () { | |
36 function setTexts(data) { | |
37 $.each(data, function (k,v) { $("#"+k).text(v); }) | |
38 } | |
39 function refresh() { | |
40 $.getJSON("frontDoorMotion", setTexts); | |
41 $.getJSON("housePower", setTexts); | |
4
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
42 |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
43 $.getJSON("housePower/raw", function (data) { |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
44 var xp=[], yp=[]; |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
45 var start = data.irLevels[0][0]; |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
46 var maxTime = 0; |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
47 $.each(data.irLevels, function (i, xy) { |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
48 maxTime = xy[0] - start; |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
49 xp.push(maxTime.toPrecision(3)); |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
50 yp.push(xy[1]); |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
51 }); |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
52 // edit with http://imagecharteditor.appspot.com/ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
53 $("#raw").attr("src", |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
54 "http://chart.apis.google.com/chart"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
55 "?chxr=0,0,"+maxTime+"|1,0,1024"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
56 "&chds=0,"+maxTime+",0,1024"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
57 "&chxl=2:|seconds"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
58 "&chxs=0,676767,11.5,0,lt,676767|1,676767,11.5,-0.5,l,676767"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
59 "&chxt=x,y,x"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
60 "&chs=600x200"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
61 "&cht=lxy"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
62 "&chco=76A4FB"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
63 "&chd=t:"+xp.join(",")+"|"+yp.join(",")+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
64 "&chg=10,20"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
65 "&chls=2"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
66 "&chma=40,20,20,30"+ |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
67 "&chm=h,FF0000,0,0.7:50:2,1"); |
be855a111619
move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents:
0
diff
changeset
|
68 }); |
0 | 69 } |
70 refresh(); | |
71 $("#refresh").click(refresh); | |
72 }); | |
73 // ]]> | |
74 </script> | |
75 </body> | |
76 </html> |