moved listening to plejd events
This commit is contained in:
parent
ce84a296ab
commit
58041b1d99
1 changed files with 5 additions and 6 deletions
|
|
@ -160,8 +160,12 @@ class PlejdService extends EventEmitter {
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await this.onDeviceConnected(connectedDevice);
|
await this.onDeviceConnected(connectedDevice);
|
||||||
|
|
||||||
await this.adapter.StopDiscovery();
|
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);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -482,11 +486,6 @@ class PlejdService extends EventEmitter {
|
||||||
onDeviceCharacteristicsComplete() {
|
onDeviceCharacteristicsComplete() {
|
||||||
logger('onDeviceCharacteristicsComplete()');
|
logger('onDeviceCharacteristicsComplete()');
|
||||||
this.authenticate();
|
this.authenticate();
|
||||||
|
|
||||||
// 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 onLastDataUpdated(iface, properties, invalidated) {
|
async onLastDataUpdated(iface, properties, invalidated) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue