added sorted list of devices discovered

This commit is contained in:
icanos 2020-01-18 16:00:31 +00:00
parent eead389056
commit b039baea5b
7 changed files with 15 additions and 71 deletions

View file

@ -45,7 +45,7 @@ class PlejdApi extends EventEmitter {
login() {
console.log('plejd-api: login()');
console.log('logging into ' + this.siteName);
console.log('plejd-api: logging into ' + this.siteName);
const self = this;
const instance = axios.create({
@ -100,7 +100,8 @@ class PlejdApi extends EventEmitter {
self.site = response.data.result.find(x => x.site.title == self.siteName);
self.cryptoKey = self.site.plejdMesh.cryptoKey;
callback(self.cryptoKey);
this.emit('ready', self.cryptoKey);
//callback(self.cryptoKey);
})
.catch((error) => {
console.log('error: unable to retrieve the crypto key. error: ' + error + ' (code: ' + error.response.status + ')');