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('InterfacesAdded', this.onInterfacesAdded.bind(this));
|
||||||
this.objectManager.on('InterfacesRemoved', this.onInterfacesRemoved.bind(this));
|
|
||||||
|
|
||||||
this.adapter.SetDiscoveryFilter({
|
this.adapter.SetDiscoveryFilter({
|
||||||
'UUIDs': new dbus.Variant('as', [PLEJD_SERVICE]),
|
'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) {
|
updateSettings(settings) {
|
||||||
if (settings.debug) {
|
if (settings.debug) {
|
||||||
debug = 'console';
|
debug = 'console';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Plejd",
|
"name": "Plejd",
|
||||||
"version": "0.2.8",
|
"version": "0.3.0",
|
||||||
"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.2.8";
|
const version = "0.3.0";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('starting Plejd add-on v. ' + version);
|
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);
|
const client = new mqtt.MqttClient(config.mqttBroker, config.mqttUsername, config.mqttPassword);
|
||||||
|
|
||||||
plejdApi.once('loggedIn', () => {
|
plejdApi.once('loggedIn', () => {
|
||||||
plejdApi.getCryptoKey();//(cryptoKey) => {
|
plejdApi.getCryptoKey();
|
||||||
plejdApi.on('ready', (cryptoKey) => {
|
plejdApi.on('ready', (cryptoKey) => {
|
||||||
const devices = plejdApi.getDevices();
|
const devices = plejdApi.getDevices();
|
||||||
|
|
||||||
|
|
@ -28,6 +28,13 @@ async function main() {
|
||||||
|
|
||||||
// init the BLE interface
|
// init the BLE interface
|
||||||
const plejd = new PlejdService(cryptoKey, true);
|
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.init();
|
||||||
|
|
||||||
plejd.on('authenticated', () => {
|
plejd.on('authenticated', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue