From c078683e710853c329261c3a46bfea61c4792583 Mon Sep 17 00:00:00 2001 From: Marcus Westin Date: Mon, 20 Jan 2020 14:10:30 +0000 Subject: [PATCH] moved again --- plejd/ble.bluez.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plejd/ble.bluez.js b/plejd/ble.bluez.js index 36b4e6a..2e09dcf 100644 --- a/plejd/ble.bluez.js +++ b/plejd/ble.bluez.js @@ -161,11 +161,6 @@ class PlejdService extends EventEmitter { setTimeout(async () => { await this.onDeviceConnected(connectedDevice); await this.adapter.StopDiscovery(); - - // After we've authenticated, we need to hook up the event listener - // for changes to lastData. - this.characteristics.lastDataProperties.on('PropertiesChanged', this.onLastDataUpdated.bind(this)); - this.characteristics.lastData.StartNotify(); }, 2000); } @@ -337,6 +332,11 @@ class PlejdService extends EventEmitter { // Start ping logger('onAuthenticated()'); this.startPing(); + + // After we've authenticated, we need to hook up the event listener + // for changes to lastData. + this.characteristics.lastDataProperties.on('PropertiesChanged', this.onLastDataUpdated.bind(this)); + this.characteristics.lastData.StartNotify(); } async startPing() {