This is this an unofficial Node.js API for Big Ass Fans - fans with SenseME.
In particular - all development was done on a Haiku fan with SenseME.
Two major components - the FanMaster and the BigAssFan.
Every fan needs a FanMaster
! Because that's where the messages come from!
new bigAssApi.FanMaster(numberOfExpectedFans)
onFanFullyUpdated
- callback you can override - called with every new fully initialized fanonFanConnection
- callback you can override - called with every new fan connection with the fan connected
undefined
)rescanForFans
- rescans for all fansrescanUntilAllFans
- continues rescanning until fanMaster.numberOfExpectedFans >= fansFound
allFans
- dictionary containing all of the fans - keyed off of the user given namepollingIntervalForFans
- polling interval if numberOfExpectedFans < fansFound
npm install BigAssFansAPI
var bigAssApi = require("BigAssFansAPI");
var myMaster = new bigAssApi.FanMaster(1); // Expect only one fan in my setup
myMaster.onFanFullyUpdated = 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
};
To see more examples, navigate to the examples directory!
maxRetries
, waitTimeOnRetry
can be set as fan properties)myBigAss.light.registerUpdateCallback("brightness", function (newValue) {});
unregisterUpdateCallback(id)
where id
is the return of registerUpdateCallback()
light.brightness
on BigAssFan: myBigAss
call myBigAss.light.update('brightness', optionalCallback)
;myBigAss.update('light', optionalCallback);
or myBigAss.updateAll(optionalCallback);
myBigAss.light.setProperty('brightness', callback)
you can know when your set succeeded (or failed)fan.isOn
- bool valuefan.speed
fan.min
fan.max
fan.auto
fan.whoosh
fan.isSpinningForwards
- bool valuelight.brightness
light.min
light.max
light.auto
light.exists
- readonly - bool valuelight.isOccupied
- readonly - bool valuelight.minTimeout
light.maxTimeout
light.timeout
learn.isOn
- bool valuelearn.minSpeed
learn.maxSpeed
learn.zeroTemp
sleep.isOn
- bool valuesleep.smartIdealTemp
sleep.minSpeed
sleep.maxSpeed
device.beeper
- bool valuedevice.indicators
- bool valuedevice.winterMode
- bool valuedevice.height
device.token
- readonly
device.dhcp
- bool valuedevice.fw
- readonlydevice.broadcastSSID
- readonlydevice.isAccessPoint
- bool valueThrough the magic of Wireshark! And the time granted by a weekend!
Pretty sure all the API's I saw when sniffing are now in here. But that'll probably change as BigAssFans adds more features.
I am in no way am associated with Big Ass Fans. Also this can break at any time if they change their API. I'm also in no way am responsible for you damaging your fan by using this API.
(However - I would be surprised if you did)