reconnect and version up
This commit is contained in:
parent
667beaa11f
commit
ce84a296ab
3 changed files with 11 additions and 9 deletions
|
|
@ -109,7 +109,6 @@ class PlejdService extends EventEmitter {
|
|||
}
|
||||
|
||||
this.objectManager.on('InterfacesAdded', this.onInterfacesAdded.bind(this));
|
||||
this.objectManager.on('InterfacesRemoved', this.onInterfacesRemoved.bind(this));
|
||||
|
||||
this.adapter.SetDiscoveryFilter({
|
||||
'UUIDs': new dbus.Variant('as', [PLEJD_SERVICE]),
|
||||
|
|
@ -200,10 +199,6 @@ class PlejdService extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
async onInterfacesRemoved(path, interfaces) {
|
||||
const [adapter, dev, service, characteristic] = path.split('/').slice(3);
|
||||
}
|
||||
|
||||
updateSettings(settings) {
|
||||
if (settings.debug) {
|
||||
debug = 'console';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Plejd",
|
||||
"version": "0.2.8",
|
||||
"version": "0.3.0",
|
||||
"slug": "plejd",
|
||||
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
||||
"url": "https://github.com/icanos/hassio-plejd/",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const mqtt = require('./mqtt');
|
|||
const fs = require('fs');
|
||||
const PlejdService = require('./ble.bluez');
|
||||
|
||||
const version = "0.2.8";
|
||||
const version = "0.3.0";
|
||||
|
||||
async function main() {
|
||||
console.log('starting Plejd add-on v. ' + version);
|
||||
|
|
@ -15,7 +15,7 @@ async function main() {
|
|||
const client = new mqtt.MqttClient(config.mqttBroker, config.mqttUsername, config.mqttPassword);
|
||||
|
||||
plejdApi.once('loggedIn', () => {
|
||||
plejdApi.getCryptoKey();//(cryptoKey) => {
|
||||
plejdApi.getCryptoKey();
|
||||
plejdApi.on('ready', (cryptoKey) => {
|
||||
const devices = plejdApi.getDevices();
|
||||
|
||||
|
|
@ -28,8 +28,15 @@ async function main() {
|
|||
|
||||
// init the BLE interface
|
||||
const plejd = new PlejdService(cryptoKey, true);
|
||||
plejd.on('connectFailed', () => {
|
||||
setTimeout(() => {
|
||||
console.log('plejd-ble: were unable to connect, will retry connection in 10 seconds.');
|
||||
plejd.init();
|
||||
}, 10000);
|
||||
});
|
||||
|
||||
plejd.init();
|
||||
|
||||
|
||||
plejd.on('authenticated', () => {
|
||||
console.log('plejd: connected via bluetooth.');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue