Skip to content

Commit 612e7ea

Browse files
author
dbaba
committed
Fix an issue where the wrong status was emitted on unsubscribing a notification
1 parent 3e46324 commit 612e7ea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/generic-ble.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,12 @@ module.exports = function (RED) {
738738
this.emit('error', err);
739739
this.log(`unsubscription error: ${err.message}`);
740740
} else {
741-
this.emit('connected');
741+
const peripheral = noble._peripherals[this.uuid];
742+
if (peripheral) {
743+
this.emit(peripheral.state);
744+
} else {
745+
this.emit('missing');
746+
}
742747
}
743748
});
744749
}, 5000);

0 commit comments

Comments
 (0)