some changes to global mode

This commit is contained in:
Martin Donnelly 2017-02-28 23:02:52 +00:00
parent 6ff04e4b47
commit 656c1920f1
2 changed files with 6 additions and 1 deletions

View File

@ -62,6 +62,11 @@ const mqttClient = function(events) {
}
});
this.updateGlobal = function(newStatus) {
globalMode = (newStatus === 0) ? 'FanOff' : 'FanOn';
logger.info('updateGlobal changed to: ', globalMode);
};
this.storeData = function(data, alt) {
if (!this.first) {
this.first = true;

View File

@ -44,7 +44,7 @@ wemo.discover(function(deviceInfo) {
// Handle BinaryState events
wemoClient.on('binaryState', function(value) {
logger.debug('Binary State changed to: %s', value);
busEmitter.emit('updateState', value);
mqttClient.updateGlobal(value);
});
// Turn the switch on