-
Notifications
You must be signed in to change notification settings - Fork 2
/
greenbeanEX.js
42 lines (32 loc) · 1.05 KB
/
greenbeanEX.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
var greenBean = require("green-bean");
var PID = .3;
var period = 10000 //This is the period for one ON/OFF cycle of the element.
greenBean.connect("range", function(range, PID) {
range.fctMode.write(1); // enter fct mode
setInterval(function() {
range.fctMode.write(1); // stay in fct mode
}, 15000);
var OnTime = PID * period;
var OffTime = period - OnTime;
range.elementStatus.subscribe(function(value) {
console.log("element status changed:", value);
});
range.convectionFan.write({
upperOvenConvectionFanDrivePercentage: 0,
upperOvenConvectionFanRotation: 0,
lowerOvenConvectionFanDrivePercentage: 100,
lowerOvenConvectionFanRotation: 1
});
setInterval(function(period){
range.elementStatus.write({
upperOvenElementStatus: 0,
lowerOvenElementStatus: 16
});
setTimeout(function(OffTime){
range.elementStatus.write({
upperOvenElementStatus: 0,
lowerOvenElementStatus: 0
});
},OnTime);
},period);
});