matterbridge-roborock-vacuum-plugin 1.0.8-rc07 → 1.0.8-rc08
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/dist/roborockCommunication/broadcast/client/LocalNetworkClient.js +2 -2
- package/dist/roborockService.js +8 -3
- package/matterbridge-roborock-vacuum-plugin.config.json +1 -1
- package/matterbridge-roborock-vacuum-plugin.schema.json +1 -1
- package/package.json +1 -1
- package/src/roborockCommunication/broadcast/client/LocalNetworkClient.ts +2 -2
- package/src/roborockService.ts +12 -5
|
@@ -56,7 +56,7 @@ export class LocalNetworkClient extends AbstractClient {
|
|
|
56
56
|
await this.connectionListeners.onConnected();
|
|
57
57
|
}
|
|
58
58
|
async onDisconnect() {
|
|
59
|
-
this.logger.
|
|
59
|
+
this.logger.notice('LocalNetworkClient: Socket has disconnected.');
|
|
60
60
|
this.connected = false;
|
|
61
61
|
if (this.socket) {
|
|
62
62
|
this.socket.destroy();
|
|
@@ -68,7 +68,7 @@ export class LocalNetworkClient extends AbstractClient {
|
|
|
68
68
|
await this.connectionListeners.onDisconnected();
|
|
69
69
|
}
|
|
70
70
|
async onError(result) {
|
|
71
|
-
this.logger.error('Socket connection error: ' + result);
|
|
71
|
+
this.logger.error('LocalNetworkClient: Socket connection error: ' + result);
|
|
72
72
|
this.connected = false;
|
|
73
73
|
if (this.socket) {
|
|
74
74
|
this.socket.destroy();
|
package/dist/roborockService.js
CHANGED
|
@@ -158,7 +158,7 @@ export default class RoborockService {
|
|
|
158
158
|
await this.messageProcessor.getDeviceStatus(device.duid).then((response) => {
|
|
159
159
|
if (self.deviceNotify) {
|
|
160
160
|
const message = { duid: device.duid, ...response.errorStatus, ...response.message };
|
|
161
|
-
self.logger.debug('Device status update
|
|
161
|
+
self.logger.debug('Device status update', debugStringify(message));
|
|
162
162
|
self.deviceNotify(NotifyMessageTypes.LocalMessage, message);
|
|
163
163
|
}
|
|
164
164
|
});
|
|
@@ -332,16 +332,21 @@ export default class RoborockService {
|
|
|
332
332
|
this.logger.debug('initializing the local connection for this client towards ' + this.ip);
|
|
333
333
|
this.localClient = this.messageClient.registerClient(device.duid, this.ip);
|
|
334
334
|
this.localClient.connect();
|
|
335
|
-
|
|
335
|
+
let count = 0;
|
|
336
|
+
while (!this.localClient.isConnected() && count < 20) {
|
|
337
|
+
this.logger.debug('Keep waiting for local client to connect');
|
|
338
|
+
count++;
|
|
336
339
|
await this.sleep(500);
|
|
337
340
|
}
|
|
341
|
+
if (!this.localClient.isConnected()) {
|
|
342
|
+
throw new Error('Local client did not connect after 10 attempts, something is wrong');
|
|
343
|
+
}
|
|
338
344
|
this.logger.debug('LocalClient connected');
|
|
339
345
|
}
|
|
340
346
|
}
|
|
341
347
|
catch (error) {
|
|
342
348
|
this.logger.error('Error requesting network info', error);
|
|
343
349
|
}
|
|
344
|
-
this.logger.debug('Local client connected');
|
|
345
350
|
}
|
|
346
351
|
sleep(ms) {
|
|
347
352
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "Matterbridge Roborock Vacuum Plugin",
|
|
3
|
-
"description": "matterbridge-roborock-vacuum-plugin v. 1.0.8-
|
|
3
|
+
"description": "matterbridge-roborock-vacuum-plugin v. 1.0.8-rc08 by https://github.com/RinDevJunior",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"required": ["username", "password"],
|
|
6
6
|
"properties": {
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export class LocalNetworkClient extends AbstractClient {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
private async onDisconnect(): Promise<void> {
|
|
70
|
-
this.logger.
|
|
70
|
+
this.logger.notice('LocalNetworkClient: Socket has disconnected.');
|
|
71
71
|
this.connected = false;
|
|
72
72
|
|
|
73
73
|
if (this.socket) {
|
|
@@ -82,7 +82,7 @@ export class LocalNetworkClient extends AbstractClient {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
private async onError(result: Error): Promise<void> {
|
|
85
|
-
this.logger.error('Socket connection error: ' + result);
|
|
85
|
+
this.logger.error('LocalNetworkClient: Socket connection error: ' + result);
|
|
86
86
|
this.connected = false;
|
|
87
87
|
|
|
88
88
|
if (this.socket) {
|
package/src/roborockService.ts
CHANGED
|
@@ -29,6 +29,7 @@ import type {
|
|
|
29
29
|
DeviceStatusNotify,
|
|
30
30
|
} from './roborockCommunication/index.js';
|
|
31
31
|
import { ServiceArea } from 'matterbridge/matter/clusters';
|
|
32
|
+
import { LocalNetworkClient } from './roborockCommunication/broadcast/client/LocalNetworkClient.js';
|
|
32
33
|
export type Factory<A, T> = (logger: AnsiLogger, arg: A) => T;
|
|
33
34
|
|
|
34
35
|
export default class RoborockService {
|
|
@@ -227,7 +228,7 @@ export default class RoborockService {
|
|
|
227
228
|
await this.messageProcessor.getDeviceStatus(device.duid).then((response: DeviceStatus) => {
|
|
228
229
|
if (self.deviceNotify) {
|
|
229
230
|
const message: DeviceStatusNotify = { duid: device.duid, ...response.errorStatus, ...response.message } as DeviceStatusNotify;
|
|
230
|
-
self.logger.debug('Device status update
|
|
231
|
+
self.logger.debug('Device status update', debugStringify(message));
|
|
231
232
|
self.deviceNotify(NotifyMessageTypes.LocalMessage, message);
|
|
232
233
|
}
|
|
233
234
|
});
|
|
@@ -431,19 +432,25 @@ export default class RoborockService {
|
|
|
431
432
|
|
|
432
433
|
if (this.ip) {
|
|
433
434
|
this.logger.debug('initializing the local connection for this client towards ' + this.ip);
|
|
434
|
-
this.localClient = this.messageClient.registerClient(device.duid, this.ip);
|
|
435
|
+
this.localClient = this.messageClient.registerClient(device.duid, this.ip) as LocalNetworkClient;
|
|
435
436
|
this.localClient.connect();
|
|
436
437
|
|
|
437
|
-
|
|
438
|
+
let count = 0;
|
|
439
|
+
while (!this.localClient.isConnected() && count < 20) {
|
|
440
|
+
this.logger.debug('Keep waiting for local client to connect');
|
|
441
|
+
count++;
|
|
438
442
|
await this.sleep(500);
|
|
439
443
|
}
|
|
444
|
+
|
|
445
|
+
if (!this.localClient.isConnected()) {
|
|
446
|
+
throw new Error('Local client did not connect after 10 attempts, something is wrong');
|
|
447
|
+
}
|
|
448
|
+
|
|
440
449
|
this.logger.debug('LocalClient connected');
|
|
441
450
|
}
|
|
442
451
|
} catch (error) {
|
|
443
452
|
this.logger.error('Error requesting network info', error);
|
|
444
453
|
}
|
|
445
|
-
|
|
446
|
-
this.logger.debug('Local client connected');
|
|
447
454
|
}
|
|
448
455
|
|
|
449
456
|
private sleep(ms: number): Promise<void> {
|