-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.js
More file actions
73 lines (57 loc) · 2.5 KB
/
hello.js
File metadata and controls
73 lines (57 loc) · 2.5 KB
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
$(document).ready(function() {
$.ajax({
url: "https://api.darksky.net/forecast/2ba7132f09fc2069522d9a980d4b741b/42.4851,-71.4328",
//data: myData,
type: 'GET',
crossDomain: true,
dataType: 'jsonp'
}).then(function(data) {
//$('.current-weather').append(data.currently.summary);
$(".current-weather h1").html("Weather");
$("#current-weather").html(data.currently.summary + " - " + Math.round(data.currently.temperature) + "℉");
$(".current-weather h2").html(data.currently.summary);
$('.current-temp h2').append(Math.round(data.currently.temperature));
$('.current-humidity h2').append(data.currently.humidity*100 + "%");
$('#current-humidity').append(data.currently.humidity*100 + "%");
//$('.greeting-content').append(data.content);
});
$.ajax({
url: "https://api.particle.io/v1/devices/26001c001247353136383631/air?access_token=e5ad56d7b6af5befcbf3992275e508b1c2911996",
//data: myData,
type: 'GET',
crossDomain: true,
dataType: 'json'
}).then(function(data) {
$('.greenhouse-temp h2').append(Math.round(data.result));
$('#greenhouse-temp').append(Math.round(data.result) + "℉");
console.log(data);
//$('.greeting-content').append(data.content);
});
$.ajax({
url: "https://api.particle.io/v1/devices/26001c001247353136383631/humidity?access_token=e5ad56d7b6af5befcbf3992275e508b1c2911996",
//data: myData,
type: 'GET',
crossDomain: true,
dataType: 'json'
}).then(function(data) {
$('.greenhouse-humidity h2').append(Math.round(data.result) + "%");
$("#greenhouse-humidity").append(Math.round(data.result) + "%");
$('.connected h2').append(data.coreInfo.connected);
var updated = new Date(data.coreInfo.last_heard);
$('#last-update').append(updated.toLocaleString());
console.log(data);
//$('.greeting-content').append(data.content);
});
$.ajax({
url: "https://api.particle.io/v1/devices/26001c001247353136383631/soil?access_token=e5ad56d7b6af5befcbf3992275e508b1c2911996",
//data: myData,
type: 'GET',
crossDomain: true,
dataType: 'json'
}).then(function(data) {
$('.greenhouse-soil h2').append(Math.round(data.result));
$('#soil-temp').append(Math.round(data.result) + "℉");
console.log(data);
//$('.greeting-content').append(data.content);
});
});