homebridge-openwrt-control 0.0.2-beta.76 → 0.0.2-beta.78
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 +4 -5
- package/package.json +1 -1
- package/src/dataupdate.js +1 -1
package/index.js
CHANGED
|
@@ -74,7 +74,7 @@ class OpenWrtPlatform {
|
|
|
74
74
|
.on('start', async () => {
|
|
75
75
|
try {
|
|
76
76
|
|
|
77
|
-
const
|
|
77
|
+
const deviceData = new OpenWrt(device)
|
|
78
78
|
.on('success', msg => logLevel.success && log.success(`Device: ${host}, ${msg}`))
|
|
79
79
|
.on('info', msg => log.info(`Device: ${host} ${name}, ${msg}`))
|
|
80
80
|
.on('debug', msg => log.info(`Device: ${host} ${name}, debug: ${msg}`))
|
|
@@ -88,16 +88,16 @@ class OpenWrtPlatform {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// start openwrt impulse generator
|
|
91
|
-
await
|
|
91
|
+
await deviceData.impulseGenerator.state(true, [{ name: 'connect', sampling: refreshInterval }], false);
|
|
92
92
|
|
|
93
93
|
for (const deviceType of configuredDevices) {
|
|
94
94
|
let configuredDevice;
|
|
95
95
|
switch (deviceType) {
|
|
96
96
|
case 0:
|
|
97
|
-
configuredDevice = new AccessPoint(api, device,
|
|
97
|
+
configuredDevice = new AccessPoint(api, device, deviceData, openWrtInfo);
|
|
98
98
|
break;
|
|
99
99
|
case 1:
|
|
100
|
-
configuredDevice = new Switch(api, device,
|
|
100
|
+
configuredDevice = new Switch(api, device, deviceData, openWrtInfo);
|
|
101
101
|
break;
|
|
102
102
|
default:
|
|
103
103
|
if (logLevel.warn) log.warn(`Device: ${host} ${name}, class not found for: ${deviceType}`);
|
|
@@ -133,7 +133,6 @@ class OpenWrtPlatform {
|
|
|
133
133
|
} catch (error) {
|
|
134
134
|
if (logLevel.error) log.error(`Device: ${host} ${name}, Did finish launching error: ${error.message ?? error}`);
|
|
135
135
|
}
|
|
136
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
137
136
|
}
|
|
138
137
|
});
|
|
139
138
|
}
|
package/package.json
CHANGED
package/src/dataupdate.js
CHANGED
|
@@ -22,7 +22,7 @@ class DataUpdate extends EventEmitter {
|
|
|
22
22
|
|
|
23
23
|
async updateState(openWrtInfo) {
|
|
24
24
|
try {
|
|
25
|
-
if (this.logDebug) this.emit('debug', `OpenWrt info data: ${JSON.stringify(openWrtInfo, null, 2)}`);
|
|
25
|
+
if (!this.logDebug) this.emit('debug', `OpenWrt info data: ${JSON.stringify(openWrtInfo, null, 2)}`);
|
|
26
26
|
|
|
27
27
|
if (this.firstRun) {
|
|
28
28
|
this.emit('deviceInfo', openWrtInfo);
|