minor fixes

This commit is contained in:
Marcus Westin 2020-01-24 10:20:39 +01:00
parent ff1952cd88
commit df4cdc1141
4 changed files with 10 additions and 10 deletions

View file

@ -323,6 +323,10 @@ class PlejdService extends EventEmitter {
}
async write(data, retry = true) {
if (!this.plejdService || !this.characteristics.data) {
return;
}
try {
console.log('plejd-ble: sending ' + data.length + ' byte(s) of data to Plejd');
const encryptedData = this._encryptDecrypt(this.cryptoKey, this.plejdService.addr, data);
@ -480,6 +484,12 @@ class PlejdService extends EventEmitter {
return;
}
if (!this.characteristics.auth) {
console.log('plejd-ble: error: unable to connect to the Plejd mesh.');
this.emit('connectFailed');
return;
}
await this.authenticate();
}

View file

@ -39,7 +39,6 @@ const getDiscoveryPayload = device => ({
state_topic: getStateTopic(device),
command_topic: getCommandTopic(device),
optimistic: false,
retain: true,
brightness: `${device.dimmable}`,
device: {
identifiers: device.serialNumber,

View file

@ -199,14 +199,6 @@
"type": "^1.0.1"
}
},
"dbus": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/dbus/-/dbus-1.0.5.tgz",
"integrity": "sha512-itMup/0lcjnwV4DULJtI8q37Nky713KE2b1QM4+W/0zlzAsMNJZURBtyENtnJc6BlHouqbur++PXWeEKDuGulg==",
"requires": {
"nan": "^2.13.2"
}
},
"dbus-next": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/dbus-next/-/dbus-next-0.8.1.tgz",

View file

@ -3,7 +3,6 @@
"@abandonware/bluetooth-hci-socket": "0.5.3-3",
"axios": "^0.19.0",
"buffer-xor": "^2.0.2",
"dbus": "^1.0.5",
"dbus-next": "^0.8.1",
"fs": "0.0.1-security",
"jspack": "0.0.4",