homebridge-openwrt-control 0.2.1-beta.21 → 0.2.1-beta.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/openwrt.js +4 -9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "OpenWrt Control",
3
3
  "name": "homebridge-openwrt-control",
4
- "version": "0.2.1-beta.21",
4
+ "version": "0.2.1-beta.23",
5
5
  "description": "Homebridge plugin to control OpenWrt flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/openwrt.js CHANGED
@@ -194,7 +194,6 @@ class OpenWrt extends EventEmitter {
194
194
 
195
195
  // Restart radio
196
196
  if (!restart) {
197
-
198
197
  // Toggle radio
199
198
  // Get wireless config with UCI
200
199
  const wirelessConfig = await this.ubusCall('uci', 'get', { config: 'wireless' });
@@ -219,16 +218,14 @@ class OpenWrt extends EventEmitter {
219
218
 
220
219
  // Commit
221
220
  await this.ubusCall('uci', 'commit', { config: 'wireless' });
222
- //await this.ubusCall('network.wireless', 'reload');
221
+ if (this.logDebug) this.emit('debug', `Send radio ${radioName} ${state ? 'enabled' : 'disabled'}`);
223
222
  }
224
223
 
225
224
  // Reload
226
225
  await this.ubusCall('network.wireless', 'down', { device: radioName });
227
- await new Promise(resolve => setTimeout(resolve, 1000));
226
+ await new Promise(resolve => setTimeout(resolve, 2000));
228
227
  await this.ubusCall('network.wireless', 'up', { device: radioName });
229
228
  if (this.logDebug) this.emit('debug', `Radio ${radioName} restarted`);
230
-
231
- if (this.logDebug) this.emit('debug', `Send radio ${radioName} ${state ? 'enabled' : 'disabled'}`);
232
229
  });
233
230
  break;
234
231
  case 'ssid':
@@ -258,15 +255,13 @@ class OpenWrt extends EventEmitter {
258
255
 
259
256
  // Commit
260
257
  await this.ubusCall('uci', 'commit', { config: 'wireless' });
261
- //await this.ubusCall('network.wireless', 'reload');
258
+ if (this.logDebug) this.emit('debug', `Send SSID ${ssidName} on ${radioName} ${state ? 'enabled' : 'disabled'}`);
262
259
 
263
260
  // Reload
264
261
  await this.ubusCall('network.wireless', 'down', { device: radioName });
265
- await new Promise(resolve => setTimeout(resolve, 1000));
262
+ await new Promise(resolve => setTimeout(resolve, 2000));
266
263
  await this.ubusCall('network.wireless', 'up', { device: radioName });
267
264
  if (this.logDebug) this.emit('debug', `Radio ${radioName} restarted`);
268
-
269
- if (this.logDebug) this.emit('debug', `Send SSID ${ssidName} on ${radioName} ${state ? 'enabled' : 'disabled'}`);
270
265
  });
271
266
  break;
272
267
  case 'button':