potential bug fixed and new version
This commit is contained in:
parent
1deb59ce6b
commit
0fa82e3681
3 changed files with 7 additions and 6 deletions
|
|
@ -450,21 +450,22 @@ class PlejdService extends EventEmitter {
|
||||||
console.log('onDeviceConnected()');
|
console.log('onDeviceConnected()');
|
||||||
|
|
||||||
const objects = await this.objectManager.GetManagedObjects();
|
const objects = await this.objectManager.GetManagedObjects();
|
||||||
|
const paths = Object.keys(objects);
|
||||||
let characteristics = [];
|
let characteristics = [];
|
||||||
|
|
||||||
for (const path of Object.keys(objects)) {
|
for (const path of paths) {
|
||||||
const interfaces = Object.keys(objects[path]);
|
const interfaces = Object.keys(objects[path]);
|
||||||
if (interfaces.indexOf(GATT_CHRC_ID) > -1) {
|
if (interfaces.indexOf(GATT_CHRC_ID) > -1) {
|
||||||
characteristics.push(path);
|
characteristics.push(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const path of Object.keys(objects)) {
|
for (const path of paths) {
|
||||||
const interfaces = Object.keys(objects[path]);
|
const interfaces = Object.keys(objects[path]);
|
||||||
if (interfaces.indexOf(GATT_SERVICE_ID) > -1) {
|
if (interfaces.indexOf(GATT_SERVICE_ID) > -1) {
|
||||||
let chPaths = [];
|
let chPaths = [];
|
||||||
for (const c of characteristics) {
|
for (const c of characteristics) {
|
||||||
if (c[0] === '/') {
|
if (c.startsWith(path + '/')) {
|
||||||
chPaths.push(c);
|
chPaths.push(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -485,7 +486,7 @@ class PlejdService extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.characteristics.auth) {
|
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');
|
this.emit('connectFailed');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Plejd",
|
"name": "Plejd",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"slug": "plejd",
|
"slug": "plejd",
|
||||||
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
||||||
"url": "https://github.com/icanos/hassio-plejd/",
|
"url": "https://github.com/icanos/hassio-plejd/",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const mqtt = require('./mqtt');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const PlejdService = require('./ble.bluez');
|
const PlejdService = require('./ble.bluez');
|
||||||
|
|
||||||
const version = "0.3.1";
|
const version = "0.3.2";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('starting Plejd add-on v. ' + version);
|
console.log('starting Plejd add-on v. ' + version);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue