homebridge-openwrt-control 0.0.2-beta.23 → 0.0.2-beta.25
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/package.json +1 -1
- package/src/openwrt.js +5 -5
package/package.json
CHANGED
package/src/openwrt.js
CHANGED
|
@@ -78,12 +78,12 @@ class OpenWrt extends EventEmitter {
|
|
|
78
78
|
return this.sessionId;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async ubusCall(service, method,
|
|
81
|
+
async ubusCall(service, method, params = {}) {
|
|
82
82
|
const session = await this.login();
|
|
83
83
|
|
|
84
84
|
const response = await this.axiosInstance.post('', {
|
|
85
85
|
jsonrpc: '2.0',
|
|
86
|
-
id:
|
|
86
|
+
id: 2,
|
|
87
87
|
method: 'call',
|
|
88
88
|
params: [session, service, method, params]
|
|
89
89
|
});
|
|
@@ -99,10 +99,10 @@ class OpenWrt extends EventEmitter {
|
|
|
99
99
|
const openWrtInfo = { state: false, systemInfo: {}, wirelessStatus: {}, wirelessRadios: [], ssids: [] }
|
|
100
100
|
|
|
101
101
|
try {
|
|
102
|
-
const systemInfo = await this.ubusCall('system', 'board'
|
|
103
|
-
if (
|
|
102
|
+
const systemInfo = await this.ubusCall('system', 'board');
|
|
103
|
+
if (this.logDebug) this.emit('debug', `System info data: ${JSON.stringify(systemInfo, null, 2)}`);
|
|
104
104
|
|
|
105
|
-
const wirelessStatus = await this.ubusCall('network.wireless', 'status'
|
|
105
|
+
const wirelessStatus = await this.ubusCall('network.wireless', 'status');
|
|
106
106
|
if (this.logDebug) this.emit('debug', `Wireless status data: ${JSON.stringify(wirelessStatus, null, 2)}`);
|
|
107
107
|
|
|
108
108
|
const wirelessRadios = Object.values(wirelessStatus.radios).map(radio => ({
|