homebridge-openwrt-control 0.0.2-beta.27 → 0.0.2-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -14,7 +14,6 @@ class OpenWrtPlatform {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
this.accessories = [];
|
|
17
|
-
this.devices = [];
|
|
18
17
|
|
|
19
18
|
//check if prefs directory exist
|
|
20
19
|
const prefDir = join(api.user.storagePath(), 'openWrt');
|
|
@@ -61,11 +60,11 @@ class OpenWrtPlatform {
|
|
|
61
60
|
log.info(`Device: ${host} ${name}, Config: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
62
61
|
}
|
|
63
62
|
|
|
63
|
+
const configuredDevices = [];
|
|
64
64
|
const refreshInterval = (deviceConfig.refreshInterval ?? 5) * 1000;
|
|
65
|
-
if (deviceConfig.accessPoint?.enable)
|
|
66
|
-
if (deviceConfig.switch?.enable)
|
|
67
|
-
|
|
68
|
-
if (this.devices.length === 0) return;
|
|
65
|
+
if (deviceConfig.accessPoint?.enable) configuredDevices.push('accessPoint');
|
|
66
|
+
if (deviceConfig.switch?.enable) configuredDevices.push('switch');
|
|
67
|
+
if (configuredDevices.length === 0) return;
|
|
69
68
|
|
|
70
69
|
const openWrt = new OpenWrt(deviceConfig)
|
|
71
70
|
.on('success', msg => logLevel.success && log.success(`Device: ${host}, ${msg}`))
|
|
@@ -81,7 +80,7 @@ class OpenWrtPlatform {
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
try {
|
|
84
|
-
for (const device of
|
|
83
|
+
for (const device of configuredDevices) {
|
|
85
84
|
// create impulse generator
|
|
86
85
|
const impulseGenerator = new ImpulseGenerator()
|
|
87
86
|
.on('start', async () => {
|
package/package.json
CHANGED