-
Notifications
You must be signed in to change notification settings - Fork 0
/
cascadia.js
51 lines (45 loc) · 1.18 KB
/
cascadia.js
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
const gqlLifxClient = require('./src/gqlLifxClient');
gqlLifxClient()
.then(client => {
client.on('newLight', (light) => {
const colors = [
{
name: 'blue',
hue: 228,
saturation: 100,
brightness: 40,
kelvin: 8000,
duration: 2000
},
{
name: 'green',
hue: 122,
saturation: 100,
brightness: 40,
kelvin: 8000,
duration: 2000
},
{
name: 'white',
hue: 170,
saturation: 68,
brightness: 40,
kelvin: 8000,
duration: 2000
}
];
let count = colors.length;
gqlLifxClient().allLightsOn()
.then(() => {
setInterval(() => {
const c = colors[(count % colors.length)];
console.log('========================', c.name);//, result);
gqlLifxClient().allLightsColor(c.hue, c.saturation, c.brightness, c.kelvin, c.duration)
.then(result => {
count++;
console.log('========================');//, result);
});
}, 2200);
})
});
});