matterbridge-roborock-vacuum-plugin 1.1.0-rc09 โ 1.1.0-rc11
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/platform.js +6 -4
- package/dist/roborockCommunication/RESTAPI/roborockIoTApi.js +22 -0
- package/dist/roborockCommunication/Zmodel/map.js +1 -0
- package/dist/roborockCommunication/Zmodel/mapInfo.js +26 -0
- package/dist/roborockCommunication/Zmodel/multipleMap.js +1 -0
- package/dist/roborockCommunication/broadcast/abstractClient.js +10 -2
- package/dist/roborockCommunication/broadcast/client/LocalNetworkClient.js +22 -2
- package/dist/roborockCommunication/broadcast/client/MQTTClient.js +4 -0
- package/dist/roborockCommunication/broadcast/clientRouter.js +2 -2
- package/dist/roborockCommunication/broadcast/listener/implementation/connectionStateListener.js +9 -2
- package/dist/roborockCommunication/broadcast/listener/implementation/syncMessageListener.js +3 -2
- package/dist/roborockCommunication/broadcast/messageProcessor.js +6 -3
- package/dist/roborockCommunication/helper/messageDeserializer.js +9 -3
- package/dist/roborockCommunication/helper/messageSerializer.js +6 -0
- package/dist/roborockCommunication/index.js +1 -0
- package/dist/roborockService.js +84 -13
- package/eslint.config.js +1 -1
- 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/platform.ts +7 -5
- package/src/roborockCommunication/RESTAPI/roborockIoTApi.ts +25 -1
- package/src/roborockCommunication/Zmodel/device.ts +1 -0
- package/src/roborockCommunication/Zmodel/map.ts +14 -0
- package/src/roborockCommunication/Zmodel/mapInfo.ts +34 -0
- package/src/roborockCommunication/Zmodel/multipleMap.ts +8 -0
- package/src/roborockCommunication/Zmodel/userData.ts +0 -3
- package/src/roborockCommunication/broadcast/abstractClient.ts +13 -4
- package/src/roborockCommunication/broadcast/client/LocalNetworkClient.ts +26 -2
- package/src/roborockCommunication/broadcast/client/MQTTClient.ts +4 -0
- package/src/roborockCommunication/broadcast/client.ts +1 -1
- package/src/roborockCommunication/broadcast/clientRouter.ts +3 -3
- package/src/roborockCommunication/broadcast/listener/implementation/connectionStateListener.ts +10 -2
- package/src/roborockCommunication/broadcast/listener/implementation/syncMessageListener.ts +4 -3
- package/src/roborockCommunication/broadcast/messageProcessor.ts +9 -5
- package/src/roborockCommunication/helper/messageDeserializer.ts +9 -3
- package/src/roborockCommunication/helper/messageSerializer.ts +6 -0
- package/src/roborockCommunication/index.ts +2 -0
- package/src/roborockService.ts +96 -17
- package/src/tests/roborockCommunication/broadcast/listener/implementation/syncMessageListener.test.ts +5 -4
- package/src/tests/roborockService.test.ts +3 -11
- package/web-for-testing/README.md +47 -0
- package/web-for-testing/nodemon.json +7 -0
- package/web-for-testing/package-lock.json +6598 -0
- package/web-for-testing/package.json +36 -0
- package/web-for-testing/src/accountStore.ts +8 -0
- package/web-for-testing/src/app.ts +194 -0
- package/web-for-testing/tsconfig-ext.json +19 -0
- package/web-for-testing/tsconfig.json +23 -0
- package/web-for-testing/views/index.ejs +172 -0
- package/web-for-testing/watch.mjs +93 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SyncMessageListener } from '../../../../../roborockCommunication/broadcast/listener/implementation/syncMessageListener';
|
|
2
2
|
import { Protocol } from '../../../../../roborockCommunication/broadcast/model/protocol';
|
|
3
|
+
import { RequestMessage } from '../../../../../roborockCommunication/broadcast/model/requestMessage';
|
|
3
4
|
|
|
4
5
|
describe('SyncMessageListener', () => {
|
|
5
6
|
let listener: SyncMessageListener;
|
|
@@ -20,7 +21,7 @@ describe('SyncMessageListener', () => {
|
|
|
20
21
|
const resolve = jest.fn();
|
|
21
22
|
const reject = jest.fn();
|
|
22
23
|
const messageId = 123;
|
|
23
|
-
listener.waitFor(messageId, resolve, reject);
|
|
24
|
+
listener.waitFor(messageId, { method: 'test' } as RequestMessage, resolve, reject);
|
|
24
25
|
|
|
25
26
|
const dps = { id: messageId, result: { foo: 'bar' } };
|
|
26
27
|
const message = {
|
|
@@ -38,7 +39,7 @@ describe('SyncMessageListener', () => {
|
|
|
38
39
|
const resolve = jest.fn();
|
|
39
40
|
const reject = jest.fn();
|
|
40
41
|
const messageId = 456;
|
|
41
|
-
listener.waitFor(messageId, resolve, reject);
|
|
42
|
+
listener.waitFor(messageId, { method: 'test' } as RequestMessage, resolve, reject);
|
|
42
43
|
|
|
43
44
|
const dps = { id: messageId, result: ['ok'] };
|
|
44
45
|
const message = {
|
|
@@ -56,7 +57,7 @@ describe('SyncMessageListener', () => {
|
|
|
56
57
|
const resolve = jest.fn();
|
|
57
58
|
const reject = jest.fn();
|
|
58
59
|
const messageId = 789;
|
|
59
|
-
listener.waitFor(messageId, resolve, reject);
|
|
60
|
+
listener.waitFor(messageId, { method: 'test' } as RequestMessage, resolve, reject);
|
|
60
61
|
|
|
61
62
|
const dps = { id: messageId };
|
|
62
63
|
const message = {
|
|
@@ -73,7 +74,7 @@ describe('SyncMessageListener', () => {
|
|
|
73
74
|
const resolve = jest.fn();
|
|
74
75
|
const reject = jest.fn();
|
|
75
76
|
const messageId = 321;
|
|
76
|
-
listener.waitFor(messageId, resolve, reject);
|
|
77
|
+
listener.waitFor(messageId, { method: 'test' } as RequestMessage, resolve, reject);
|
|
77
78
|
|
|
78
79
|
expect(listener['pending'].has(messageId)).toBe(true);
|
|
79
80
|
|
|
@@ -2,7 +2,7 @@ import { AnsiLogger } from 'matterbridge/logger';
|
|
|
2
2
|
import { ServiceArea } from 'matterbridge/matter/clusters';
|
|
3
3
|
import RoborockService from '../roborockService';
|
|
4
4
|
import { MessageProcessor } from '../roborockCommunication/broadcast/messageProcessor';
|
|
5
|
-
import { Device } from '../roborockCommunication';
|
|
5
|
+
import { Device, RequestMessage } from '../roborockCommunication';
|
|
6
6
|
|
|
7
7
|
describe('RoborockService - startClean', () => {
|
|
8
8
|
let roborockService: RoborockService;
|
|
@@ -316,20 +316,12 @@ describe('RoborockService - customGet/customGetInSecure/customSend', () => {
|
|
|
316
316
|
|
|
317
317
|
it('customGet should call getCustomMessage', async () => {
|
|
318
318
|
mockMessageProcessor.getCustomMessage.mockResolvedValue('result');
|
|
319
|
-
const result = await roborockService.customGet('duid', 'method');
|
|
320
|
-
expect(mockLogger.debug).toHaveBeenCalledWith('RoborockService - customSend-message', 'method');
|
|
319
|
+
const result = await roborockService.customGet('duid', { method: 'method', params: undefined, secure: true } as RequestMessage);
|
|
320
|
+
expect(mockLogger.debug).toHaveBeenCalledWith('RoborockService - customSend-message', 'method', undefined, true);
|
|
321
321
|
expect(mockMessageProcessor.getCustomMessage).toHaveBeenCalledWith('duid', expect.any(Object));
|
|
322
322
|
expect(result).toBe('result');
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
-
it('customGetInSecure should call getCustomMessage with secure', async () => {
|
|
326
|
-
mockMessageProcessor.getCustomMessage.mockResolvedValue('secureResult');
|
|
327
|
-
const result = await roborockService.customGetInSecure('duid', 'method');
|
|
328
|
-
expect(mockLogger.debug).toHaveBeenCalledWith('RoborockService - customGetInSecure-message', 'method');
|
|
329
|
-
expect(mockMessageProcessor.getCustomMessage).toHaveBeenCalledWith('duid', expect.objectContaining({ secure: true }));
|
|
330
|
-
expect(result).toBe('secureResult');
|
|
331
|
-
});
|
|
332
|
-
|
|
333
325
|
it('customSend should call sendCustomMessage', async () => {
|
|
334
326
|
const req = { foo: 'bar' } as any;
|
|
335
327
|
await roborockService.customSend('duid', req);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Web Testing Interface
|
|
2
|
+
|
|
3
|
+
This is a web-based testing interface for the Matterbridge Roborock Vacuum Plugin.
|
|
4
|
+
|
|
5
|
+
## ๐ Quick Start
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
- Node.js installed on your system
|
|
9
|
+
- Access to the main plugin source code
|
|
10
|
+
|
|
11
|
+
### Installation & Setup
|
|
12
|
+
|
|
13
|
+
1. **Copy source files:**
|
|
14
|
+
```bash
|
|
15
|
+
npm run copy-src
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. **Build the project:**
|
|
19
|
+
```bash
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. **Start the development server:**
|
|
24
|
+
```bash
|
|
25
|
+
npm run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ๐ Access
|
|
29
|
+
|
|
30
|
+
Once the server is running, open your browser and navigate to:
|
|
31
|
+
```
|
|
32
|
+
http://localhost:3000
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ๐ Authentication
|
|
36
|
+
|
|
37
|
+
Log in using your Roborock account credentials:
|
|
38
|
+
- **Username:** Your Roborock account username/email
|
|
39
|
+
- **Password:** Your Roborock account password
|
|
40
|
+
|
|
41
|
+
## ๐งช Testing
|
|
42
|
+
|
|
43
|
+
After successful authentication, you can start testing the plugin functionality through the web interface.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
**Note:** This is a development/testing tool and should not be used in production environments.
|