some changes to global mode

This commit is contained in:
Martin Donnelly 2017-02-28 22:34:35 +00:00
parent 0a56812189
commit 9fbe822c33
2 changed files with 4 additions and 2 deletions

View File

@ -161,6 +161,7 @@ const mqttClient = function(events) {
this.client.on('updateState', function(newStatus) {
globalMode = (newStatus === 0) ? 'FanOff' : 'FanOn';
logger.info('updateState changed to: ', globalMode);
});
this.client.on('message', function(topic, message) {

View File

@ -44,6 +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);
});
// Turn the switch on
@ -55,8 +56,8 @@ busEmitter.on('changeState', function(mode) {
if (wemoClient !== null) {
wemoClient.setBinaryState(mode);
let newState = wemoClient.getBinaryState();
busEmitter.emit('updateState', newState);
// let newState = wemoClient.getBinaryState();
// busEmitter.emit('updateState', newState);
} else {
console.error('No wemoClient');
}