potential bug fixed and new version

This commit is contained in:
icanos 2020-01-24 17:30:17 +00:00
parent 1deb59ce6b
commit 0fa82e3681
3 changed files with 7 additions and 6 deletions

View file

@ -450,21 +450,22 @@ class PlejdService extends EventEmitter {
console.log('onDeviceConnected()');
const objects = await this.objectManager.GetManagedObjects();
const paths = Object.keys(objects);
let characteristics = [];
for (const path of Object.keys(objects)) {
for (const path of paths) {
const interfaces = Object.keys(objects[path]);
if (interfaces.indexOf(GATT_CHRC_ID) > -1) {
characteristics.push(path);
}
}
for (const path of Object.keys(objects)) {
for (const path of paths) {
const interfaces = Object.keys(objects[path]);
if (interfaces.indexOf(GATT_SERVICE_ID) > -1) {
let chPaths = [];
for (const c of characteristics) {
if (c[0] === '/') {
if (c.startsWith(path + '/')) {
chPaths.push(c);
}
}
@ -485,7 +486,7 @@ class PlejdService extends EventEmitter {
}
if (!this.characteristics.auth) {
console.log('plejd-ble: error: unable to connect to the Plejd mesh.');
console.log('plejd-ble: error: unable to enumerate characteristics.');
this.emit('connectFailed');
return;
}

View file

@ -1,6 +1,6 @@
{
"name": "Plejd",
"version": "0.3.1",
"version": "0.3.2",
"slug": "plejd",
"description": "Adds support for the Swedish home automation devices from Plejd.",
"url": "https://github.com/icanos/hassio-plejd/",

View file

@ -3,7 +3,7 @@ const mqtt = require('./mqtt');
const fs = require('fs');
const PlejdService = require('./ble.bluez');
const version = "0.3.1";
const version = "0.3.2";
async function main() {
console.log('starting Plejd add-on v. ' + version);