const em = require('events').EventEmitter; const util = require('util'); const logger = require('log4js').getLogger('Aida'); const Wemo = require('./wemo-controller'); const MqttController = require('./mqtt-controller'); const { BedroomHeaterV2 } = require('./recipes'); logger.level = 'debug'; const devices = { 'sensors': {}, 'lights': new Map(), 'wemo': {}, 'heating': {} }; const Aida = function() { logger.debug('Aida!!'); const self = this; this.on('newListener', function(listener) { logger.debug(`Event Listener: ${ listener}`); }); this.init(); }; util.inherits(Aida, em); Aida.prototype.init = function() { this.wemo = new Wemo(); // this.hive = new Hive(); this.mqtt = new MqttController(); this.wemo.on('found', (d) => { logger.debug('Found Wemo switch:', d.macAddress); }); this.mqtt.on('found', () => { logger.debug('MQTT found device'); }); // this.hive.update(); this.BedroomRecipe = new BedroomHeaterV2({ 'mqtt':this.mqtt, 'wemo':this.wemo }); }; module.exports = Aida;