-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
194 lines (152 loc) · 6.56 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Project VariChill</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,600" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div style="margin-left:15px;padding:15px">
<h1 class="title"><span style="color: #449ed8">Vari</span><span style="color: #0f466a">Chill</span> <img src="https://image.ibb.co/hN0TAa/logo.png" width=35></h1>
<h2 id="team">Team 16</h2>
<p id="names">Dane Walton       |  Julian Mickelson
<br/>
Leandro Grigera  |  John Masson
</p>
<script>
1
var x = false;
$(document).ready(function() {
$('#chill').val('CHILLING OUT');
});
$(document).ready(function() {
$('#blinkButton')
});
</script>
<br/>
<h2 style="font-family:montserrat;font-weight:600;font-size:30px">VariChill Monitoring Functions</h2>
<p id="names">VariChill is <span id="onlineStatus" style="font-size:30px;font-weight:600"></span></p>
<p id="names">Top Box Temp: <span id="topTempNum" style="font-size:30px;font-weight:600"></span></p>
<p id="names">Vaccine Temp: <span id="bottomTempNum" style="font-size:30px;font-weight:600"></span></p>
<p id="names">Cooling Is <span id="coolingBool" style="font-size:30px;font-weight:600"></span></p>
<p id="names">Plug is <span id="plugBool" style="font-size:30px;font-weight:600"></span></p>
<br/>
<br/>
<!-- <button class="button" style="background-color: #0f466a;color:white;border-radius:4px;padding: 10px 10px;border:none" -->
<!-- id='blinkButton' type='button' onclick="plugFunc()">PLUG EEEEER UP</button> -->
<!-- <button class="button" style="background-color: #0f466a;color:white;border-radius:4px;padding: 10px 10px;border:none" -->
<!-- id='blinkButton' type='button' onclick="chillFunc()">CHILL OUT</button> -->
<br/>
<br/>
<script>
var accessToken = "124dab5e9d90650a3fee6f14e66452c1782be720";
var VariChillV2 = "32002a000851353531343431";
var testChillID = "43002a001347333438373338";
var topBoxID = 246732;
var bottomBoxID = 244773;
var plug = "Plug";
var chill = "Chill";
var toggle = "blink";
var chillOn;
var plugIn;
var online;
function plugFunc() {
var requestUrl = "https://api.spark.io/v1/devices/" + VariChillV2 + "/" + plug + "/";
$.post(requestUrl, {access_token: accessToken});
}
function chillFunc() {
var requestUrl = "https://api.spark.io/v1/devices/" + VariChillV2 + "/" + chill + "/";
$.post(requestUrl, {access_token: accessToken});
}
function toggleLED() {
var requestUrl = "https://api.spark.io/v1/devices/" + testChillID + "/" + toggle + "/";
$.post(requestUrl, {access_token: accessToken});
}
window.setInterval(function() {
requestUrl = "https://api.spark.io/v1/devices/" + VariChillV2 + "/chillBool?access_token=124dab5e9d90650a3fee6f14e66452c1782be720";
$.getJSON(requestUrl, function(json) {
chillOn = json.result;
chillOutput();
});
}, 500);
window.setInterval(function() {
requestUrl = "https://api.spark.io/v1/devices/" + VariChillV2 + "/plugBool?access_token=124dab5e9d90650a3fee6f14e66452c1782be720";
$.getJSON(requestUrl, function(json) {
plugIn = json.result;
plugOutput();
});
}, 500);
window.setInterval(function() {
requestUrl = "https://api.thingspeak.com/channels/" + topBoxID + "/feeds.json?results=1";
$.getJSON(requestUrl, function(json) {
document.getElementById("topTempNum").innerHTML = json.feeds[0].field1;
});
}, 500);
window.setInterval(function() {
requestUrl = "https://api.thingspeak.com/channels/" + bottomBoxID + "/feeds.json?results=1";
$.getJSON(requestUrl, function(json) {
document.getElementById("bottomTempNum").innerHTML = json.feeds[0].field1;
});
}, 500);
window.setInterval(function() {
requestUrl = "https://api.spark.io/v1/devices/" + VariChillV2 + "?access_token=124dab5e9d90650a3fee6f14e66452c1782be720";
$.getJSON(requestUrl, function(json) {
online = json.connected;
onlineOutput();
});
}, 500);
function clearBottomChannel() {
var requestUrl = "https://api.thingspeak.com/channels/" + bottomBoxID + "/feeds.json/?api_key=T7IPM5LRWLSILFE5";
$.ajax({
url: requestUrl,
type: "DELETE",
});
}
function clearTopChannel() {
var requestUrl = "https://api.thingspeak.com/channels/" + topBoxID + "/feeds.json/?api_key=T7IPM5LRWLSILFE5";
$.ajax({
url: requestUrl,
type: "DELETE",
});
}
function onlineOutput() {
if (online == true) {
document.getElementById("onlineStatus").innerHTML = "Online";
} else {
document.getElementById("onlineStatus").innerHTML = "Offline";
}
}
function chillOutput() {
if (chillOn == true) {
document.getElementById("coolingBool").innerHTML = "On";
} else {
document.getElementById("coolingBool").innerHTML = "Off";
}
}
function plugOutput() {
if (plugIn == true) {
document.getElementById("plugBool").innerHTML = "Closed";
} else {
document.getElementById("plugBool").innerHTML = "Open";
}
}
</script>
<br/>
<iframe width="450" height="250" style="border: 1px solid #cccccc;" src="http://thingspeak.com/channels/246732/charts/1?dynamic=true&results=100"></iframe>
<br/>
<iframe width="450" height="250" style="border: 1px solid #cccccc;" src="http://thingspeak.com/channels/244773/charts/1?dynamic=true&results=100"></iframe>
<br/>
<br/>
<!-- <button class="button" style="background-color: #0f466a;color:white;border-radius:4px;padding: 10px 10px;border:none" -->
<!-- id="clearTopChannel" type='button' onClick="clearTopChannel()">Clear Top Channel</button> -->
<!-- <button class="button" style="background-color: #0f466a;color:white;border-radius:4px;padding: 10px 10px;border:none" -->
<!-- id="clearBottomChannel" type='button' onClick="clearBottomChannel()">Clear Bottom Channel</button> -->
<br/>
</div>
</body>
</html>