forked from stabbylambda/BigAssFansAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleExample.js
More file actions
18 lines (13 loc) · 730 Bytes
/
simpleExample.js
File metadata and controls
18 lines (13 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var bigAssApi = require("../src/BigAssApi");
var myMaster = new bigAssApi.FanMaster(1); // Expect only one fan in my setup
myMaster.onDeviceFullyUpdated = function(myBigAss){
// Will automatically update / retry setting for this connected fan
myBigAss.light.brightness = 1;
myBigAss.fan.speed = 1;
console.log("Initial Big Ass Light value: " + myBigAss.light.brightness);
// Register for an update callback (say if the phone updates the property)
myBigAss.light.registerUpdateCallback("brightness", function (newValue) {
console.log("Updated brightness value: " + myBigAss.light.brightness); // or newValue
})
myBigAss.light.update("brightness"); // Forces an update to brightness
};