Skip to content

Commit

Permalink
Chore: Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Okonetchnikov authored and okonet committed Jan 4, 2020
1 parent 1c92c5f commit 82f1b05
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,27 @@ class YeePlatform {
this.api = api;
this.api.on('didFinishLaunching', async () => {
this.sock.on('message', this.handleMessage.bind(this));
log(`Searching for known devices...`);
do {
log('doing a round of proactive search for known devices.');
this.search();
// eslint-disable-next-line no-await-in-loop
await sleep(15000);
} while (Object.values(this.devices).some(x => !x.reachable));
} while (
Object.values(this.devices).some(accessory => !accessory.initialized)
);

log('all known devices found, stopping proactive search.');
log(`All known devices found. Stopping proactive search.`);
});
}

configureAccessory(accessory) {
this.log(`remembered device ${accessory.displayName}.`);
accessory.reachable = false;
this.log(`Loaded accessory ${accessory.displayName}.`);
accessory.initialized = false;
this.devices[accessory.context.did] = accessory;
}

search() {
this.log('Sending search request...');
this.sock.send(
this.searchMessage,
0,
Expand Down

0 comments on commit 82f1b05

Please sign in to comment.