forked from aklambeth/bg-hive-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclimateControl.js
58 lines (41 loc) · 1.04 KB
/
climateControl.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
52
53
54
55
56
57
58
var Widget = require('./Widget');
var util = require('util');
var request = require('request');
module.exports = ClimateControl;
function ClimateControl(context) {
Widget.call(this, context, "climate");
}
util.inherits(ClimateControl, Widget);
ClimateControl.prototype.Mode = { "Off":"OFF", "Manual":"MANUAL", "Schedule":"SCHEDULE", "Boost":"BOOST" };
ClimateControl.prototype.SetState = function(req) {
var task = {
'control':{
'PUT':{'control':req}
}
};
this.Call(task);
}
ClimateControl.prototype.GetState = function(){
this.Call({GET:{}});
}
ClimateControl.prototype.TargetTemperature = function(target){
var task = {
'targetTemperature':{
'PUT':{
'temperatureUnit':'C',
'temperature':target
}
}
};
this.Call(task);
}
ClimateControl.prototype.GetSchedule = function(){
var task = {
'controls':{
'schedule':{
'GET':{}
}
}
};
this.Call(task);
}