const xapi = require('xapi'); xapi.status.on('Standby State', state => { console.log('going to ', state); if (state === 'Halfwake') xapi.command('Standby Deactivate'); });