BigAssFansAPI
BigAssFansAPI copied to clipboard
Cannot set fan to Whoosh mode
This returns the current value of the Whoosh mode, but will not set it. What am I doing wrong?
var bigAssApi = require("../BigAssApi");
// Don't scan for any fans since we know the exact address of the fan (faster!)
var myMaster = new bigAssApi.FanMaster(0);
// Put in exact information for the fan you're trying to reach
var downriver = new bigAssApi.BigAssFan("Down River Fan", "20:F8:5E:D3:7F:90", "255.255.255.255", myMaster);
var middle = new bigAssApi.BigAssFan("Middle Fan", "20:F8:5E:D7:26:EE", "255.255.255.255", myMaster);
var upriver = new bigAssApi.BigAssFan("Up River Fan", "20:F8:5E:D6:B7:43", "255.255.255.255", myMaster);
// Set the whooshs to high
downriver.fan.whoosh = "ON";
middle.fan.whoosh = "ON";
upriver.fan.whoosh = "ON";
// Register for an update callback (say if the phone updates the property)
downriver.fan.registerUpdateCallback("whoosh", function (newValue) {
console.log("Down River Fan Updated whoosh: " + downriver.fan.whoosh); // or newValue
})
downriver.fan.update("whoosh"); // Forces an update to whoosh
// Register for an update callback (say if the phone updates the property)
middle.fan.registerUpdateCallback("whoosh", function (newValue) {
console.log("Middle Fan Updated whoosh: " + middle.fan.whoosh); // or newValue
})
middle.fan.update("whoosh"); // Forces an update to whoosh
// Register for an update callback (say if the phone updates the property)
upriver.fan.registerUpdateCallback("whoosh", function (newValue) {
console.log("Up River Fan Updated whoosh: " + upriver.fan.whoosh); // or newValue
})
upriver.fan.update("whoosh"); // Forces an update to whoosh
// Ensure that network request has time to go out
// and also that the process will always exit eventually
setTimeout(function () {
process.exit()
}, 1000)
Interesting - as far I'm aware that should work, although I don't remember actually ever trying to set Whoosh mode if I'm being honest 🙂
You said that registering the update callback is working though – does this properly print new values when you change it from the phone? And does it print "ON" or "OFF"?
Perhaps try adding bigAssApi.debug = true
right after the import statement. I believe this will print out all of the debug information
The last idea I have right now is that this line has an issue. It's possible that "STATUS" right there isn't the proper additionalProp
that's used when setting, as if I remember correctly this value doesn't need to be correct to listen for changes - but does need to be correct in order to perform changes.
I forget - but in debug mode I believe you can see all broadcasts being made my the app - so when it changes woosh mode you might see what that true sub property is, but otherwise you can try a few different values: undefined
might work, or we might need to break out wireshark again. (see the readme for instructions on how to debug with the version from github vs from npm - or just modify the npm version directly in your node_modules
folder)
I changed this
this.fan.createGetField('whoosh', ['FAN', 'WHOOSH'], true, undefined, 'ON', 'OFF');
and now get this output. I am working remote and not able to physically see the fan or do a wireshark now.
Down River Fan Updated whoosh: SET
Middle Fan Updated whoosh: SET
Up River Fan Updated whoosh: SET
Down River Fan Updated whoosh: GET
Middle Fan Updated whoosh: GET
Up River Fan Updated whoosh: GET
Sean,
Have you had a chance to look at how to get Whoosh to work? This is the only thing that I don't know how to set right now.
I am also getting the value of whoosh but not able to set it. Maybe the property is read only and needs to be set some other way?
Turns out setting whoosh doesn't require the SET command. The syntax is: <%s;FAN;WHOOSH;ON> and <%s;FAN;WHOOSH;OFF>. I've fixed it in my fork.