homebridge-midea-platform 1.2.6-beta.3 → 1.2.6-beta.4
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/homebridge-ui/server.js +5 -8
- package/package.json +1 -1
package/homebridge-ui/server.js
CHANGED
|
@@ -99,6 +99,7 @@ class Logger {
|
|
|
99
99
|
*/
|
|
100
100
|
class UiServer extends HomebridgePluginUiServer {
|
|
101
101
|
cloud;
|
|
102
|
+
smartHomeCloud;
|
|
102
103
|
promiseSocket;
|
|
103
104
|
security;
|
|
104
105
|
logger;
|
|
@@ -193,11 +194,7 @@ class UiServer extends HomebridgePluginUiServer {
|
|
|
193
194
|
|
|
194
195
|
this.onRequest("/downloadLua", async ({ deviceType, deviceSn }) => {
|
|
195
196
|
try {
|
|
196
|
-
if (!this.
|
|
197
|
-
this.pushEvent("showToast", {
|
|
198
|
-
success: true,
|
|
199
|
-
msg: "Currently used cloud provider doesn't support Lua downloading, using the default profile now...",
|
|
200
|
-
});
|
|
197
|
+
if (!this.smartHomeCloud) {
|
|
201
198
|
const username = Buffer.from(
|
|
202
199
|
(DEFAULT_SMARTHOME_ACCOUNT[0] ^ DEFAULT_SMARTHOME_ACCOUNT[1]).toString(16),
|
|
203
200
|
"hex",
|
|
@@ -206,14 +203,14 @@ class UiServer extends HomebridgePluginUiServer {
|
|
|
206
203
|
(DEFAULT_SMARTHOME_ACCOUNT[0] ^ DEFAULT_SMARTHOME_ACCOUNT[2]).toString(16),
|
|
207
204
|
"hex",
|
|
208
205
|
).toString("ascii");
|
|
209
|
-
this.
|
|
206
|
+
this.smartHomeCloud = CloudFactory.createCloud(
|
|
210
207
|
username,
|
|
211
208
|
password,
|
|
212
209
|
"Midea SmartHome (MSmartHome)",
|
|
213
210
|
);
|
|
214
|
-
await this.
|
|
211
|
+
await this.smartHomeCloud.login();
|
|
215
212
|
}
|
|
216
|
-
const lua = await this.
|
|
213
|
+
const lua = await this.smartHomeCloud.getProtocolLua(deviceType, deviceSn);
|
|
217
214
|
return lua;
|
|
218
215
|
} catch (e) {
|
|
219
216
|
const msg = e instanceof Error ? e.stack : e;
|
package/package.json
CHANGED