matterbridge-roborock-vacuum-plugin-regions 1.1.1-jb.1
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/.github/workflows/build.yml +56 -0
- package/.github/workflows/coverage.yml +59 -0
- package/.github/workflows/publish.yml +37 -0
- package/.tarignore +5 -0
- package/CHANGELOG.md +62 -0
- package/LICENSE +202 -0
- package/README.md +135 -0
- package/README_CLEANMODE.md +29 -0
- package/README_DEV.md +75 -0
- package/README_REPORT_ISSUE.md +34 -0
- package/README_SUPPORTED.md +67 -0
- package/dist/behaviorFactory.js +26 -0
- package/dist/behaviors/BehaviorDeviceGeneric.js +22 -0
- package/dist/behaviors/roborock.vacuum/default/default.js +183 -0
- package/dist/behaviors/roborock.vacuum/default/initalData.js +143 -0
- package/dist/behaviors/roborock.vacuum/default/runtimes.js +21 -0
- package/dist/behaviors/roborock.vacuum/smart/initalData.js +18 -0
- package/dist/behaviors/roborock.vacuum/smart/runtimes.js +11 -0
- package/dist/behaviors/roborock.vacuum/smart/smart.js +119 -0
- package/dist/clientManager.js +17 -0
- package/dist/helper.js +76 -0
- package/dist/index.js +4 -0
- package/dist/initialData/getBatteryStatus.js +24 -0
- package/dist/initialData/getOperationalStates.js +82 -0
- package/dist/initialData/getSupportedAreas.js +120 -0
- package/dist/initialData/getSupportedCleanModes.js +17 -0
- package/dist/initialData/getSupportedRunModes.js +11 -0
- package/dist/initialData/getSupportedScenes.js +26 -0
- package/dist/initialData/index.js +6 -0
- package/dist/model/CloudMessageModel.js +1 -0
- package/dist/model/DockingStationStatus.js +26 -0
- package/dist/model/ExperimentalFeatureSetting.js +30 -0
- package/dist/model/RoomMap.js +19 -0
- package/dist/model/roomIndexMap.js +21 -0
- package/dist/notifyMessageTypes.js +9 -0
- package/dist/platform.js +312 -0
- package/dist/platformRunner.js +90 -0
- package/dist/roborockCommunication/RESTAPI/roborockAuthenticateApi.js +213 -0
- package/dist/roborockCommunication/RESTAPI/roborockIoTApi.js +95 -0
- package/dist/roborockCommunication/Zenum/additionalPropCode.js +4 -0
- package/dist/roborockCommunication/Zenum/authenticateResponseCode.js +7 -0
- package/dist/roborockCommunication/Zenum/dockType.js +4 -0
- package/dist/roborockCommunication/Zenum/operationStatusCode.js +44 -0
- package/dist/roborockCommunication/Zenum/vacuumAndDockErrorCode.js +68 -0
- package/dist/roborockCommunication/Zmodel/apiResponse.js +1 -0
- package/dist/roborockCommunication/Zmodel/authenticateFlowState.js +1 -0
- package/dist/roborockCommunication/Zmodel/authenticateResponse.js +1 -0
- package/dist/roborockCommunication/Zmodel/baseURL.js +1 -0
- package/dist/roborockCommunication/Zmodel/batteryMessage.js +1 -0
- package/dist/roborockCommunication/Zmodel/device.js +1 -0
- package/dist/roborockCommunication/Zmodel/deviceModel.js +28 -0
- package/dist/roborockCommunication/Zmodel/deviceSchema.js +1 -0
- package/dist/roborockCommunication/Zmodel/deviceStatus.js +22 -0
- package/dist/roborockCommunication/Zmodel/dockInfo.js +6 -0
- package/dist/roborockCommunication/Zmodel/home.js +1 -0
- package/dist/roborockCommunication/Zmodel/homeInfo.js +1 -0
- package/dist/roborockCommunication/Zmodel/map.js +1 -0
- package/dist/roborockCommunication/Zmodel/mapInfo.js +29 -0
- package/dist/roborockCommunication/Zmodel/messageResult.js +7 -0
- package/dist/roborockCommunication/Zmodel/multipleMap.js +1 -0
- package/dist/roborockCommunication/Zmodel/networkInfo.js +1 -0
- package/dist/roborockCommunication/Zmodel/product.js +1 -0
- package/dist/roborockCommunication/Zmodel/room.js +1 -0
- package/dist/roborockCommunication/Zmodel/roomInfo.js +22 -0
- package/dist/roborockCommunication/Zmodel/scene.js +16 -0
- package/dist/roborockCommunication/Zmodel/userData.js +1 -0
- package/dist/roborockCommunication/Zmodel/vacuumError.js +27 -0
- package/dist/roborockCommunication/broadcast/abstractClient.js +55 -0
- package/dist/roborockCommunication/broadcast/client/LocalNetworkClient.js +174 -0
- package/dist/roborockCommunication/broadcast/client/LocalNetworkUDPClient.js +129 -0
- package/dist/roborockCommunication/broadcast/client/MQTTClient.js +139 -0
- package/dist/roborockCommunication/broadcast/client.js +1 -0
- package/dist/roborockCommunication/broadcast/clientRouter.js +82 -0
- package/dist/roborockCommunication/broadcast/listener/abstractConnectionListener.js +1 -0
- package/dist/roborockCommunication/broadcast/listener/abstractMessageHandler.js +1 -0
- package/dist/roborockCommunication/broadcast/listener/abstractMessageListener.js +1 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.js +26 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.js +11 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/connectionStateListener.js +43 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/generalSyncMessageListener.js +28 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.js +27 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/syncMessageListener.js +33 -0
- package/dist/roborockCommunication/broadcast/listener/index.js +1 -0
- package/dist/roborockCommunication/broadcast/messageProcessor.js +148 -0
- package/dist/roborockCommunication/broadcast/model/contentMessage.js +1 -0
- package/dist/roborockCommunication/broadcast/model/dps.js +1 -0
- package/dist/roborockCommunication/broadcast/model/headerMessage.js +1 -0
- package/dist/roborockCommunication/broadcast/model/messageContext.js +37 -0
- package/dist/roborockCommunication/broadcast/model/protocol.js +28 -0
- package/dist/roborockCommunication/broadcast/model/requestMessage.js +38 -0
- package/dist/roborockCommunication/broadcast/model/responseMessage.js +14 -0
- package/dist/roborockCommunication/helper/chunkBuffer.js +17 -0
- package/dist/roborockCommunication/helper/cryptoHelper.js +23 -0
- package/dist/roborockCommunication/helper/messageDeserializer.js +98 -0
- package/dist/roborockCommunication/helper/messageSerializer.js +84 -0
- package/dist/roborockCommunication/helper/nameDecoder.js +66 -0
- package/dist/roborockCommunication/helper/sequence.js +16 -0
- package/dist/roborockCommunication/index.js +13 -0
- package/dist/roborockService.js +494 -0
- package/dist/runtimes/handleCloudMessage.js +110 -0
- package/dist/runtimes/handleHomeDataMessage.js +57 -0
- package/dist/runtimes/handleLocalMessage.js +169 -0
- package/dist/rvc.js +51 -0
- package/dist/settings.js +1 -0
- package/dist/share/function.js +93 -0
- package/dist/share/runtimeHelper.js +17 -0
- package/dist/tests/testData/mockData.js +359 -0
- package/eslint.config.js +80 -0
- package/jest.config.js +22 -0
- package/jest.setup.js +2 -0
- package/logo.png +0 -0
- package/matterbridge-roborock-vacuum-plugin.config.json +46 -0
- package/matterbridge-roborock-vacuum-plugin.schema.json +293 -0
- package/misc/status.md +119 -0
- package/package.json +111 -0
- package/prettier.config.js +49 -0
- package/screenshot/IMG_1.PNG +0 -0
- package/screenshot/IMG_2.PNG +0 -0
- package/screenshot/IMG_3.PNG +0 -0
- package/screenshot/IMG_4.PNG +0 -0
- package/screenshot/IMG_5.PNG +0 -0
- package/screenshot/IMG_6.PNG +0 -0
- package/screenshot/IMG_7.PNG +0 -0
- package/src/behaviorFactory.ts +41 -0
- package/src/behaviors/BehaviorDeviceGeneric.ts +31 -0
- package/src/behaviors/roborock.vacuum/default/default.ts +238 -0
- package/src/behaviors/roborock.vacuum/default/initalData.ts +152 -0
- package/src/behaviors/roborock.vacuum/default/runtimes.ts +23 -0
- package/src/behaviors/roborock.vacuum/smart/initalData.ts +20 -0
- package/src/behaviors/roborock.vacuum/smart/runtimes.ts +15 -0
- package/src/behaviors/roborock.vacuum/smart/smart.ts +159 -0
- package/src/clientManager.ts +23 -0
- package/src/helper.ts +97 -0
- package/src/index.ts +16 -0
- package/src/initialData/getBatteryStatus.ts +26 -0
- package/src/initialData/getOperationalStates.ts +94 -0
- package/src/initialData/getSupportedAreas.ts +162 -0
- package/src/initialData/getSupportedCleanModes.ts +22 -0
- package/src/initialData/getSupportedRunModes.ts +14 -0
- package/src/initialData/getSupportedScenes.ts +32 -0
- package/src/initialData/index.ts +6 -0
- package/src/model/CloudMessageModel.ts +11 -0
- package/src/model/DockingStationStatus.ts +41 -0
- package/src/model/ExperimentalFeatureSetting.ts +77 -0
- package/src/model/RoomMap.ts +38 -0
- package/src/model/roomIndexMap.ts +26 -0
- package/src/notifyMessageTypes.ts +8 -0
- package/src/platform.ts +424 -0
- package/src/platformRunner.ts +103 -0
- package/src/roborockCommunication/RESTAPI/roborockAuthenticateApi.ts +302 -0
- package/src/roborockCommunication/RESTAPI/roborockIoTApi.ts +107 -0
- package/src/roborockCommunication/Zenum/additionalPropCode.ts +3 -0
- package/src/roborockCommunication/Zenum/authenticateResponseCode.ts +6 -0
- package/src/roborockCommunication/Zenum/dockType.ts +3 -0
- package/src/roborockCommunication/Zenum/operationStatusCode.ts +43 -0
- package/src/roborockCommunication/Zenum/vacuumAndDockErrorCode.ts +68 -0
- package/src/roborockCommunication/Zmodel/apiResponse.ts +3 -0
- package/src/roborockCommunication/Zmodel/authenticateFlowState.ts +6 -0
- package/src/roborockCommunication/Zmodel/authenticateResponse.ts +5 -0
- package/src/roborockCommunication/Zmodel/baseURL.ts +5 -0
- package/src/roborockCommunication/Zmodel/batteryMessage.ts +16 -0
- package/src/roborockCommunication/Zmodel/device.ts +50 -0
- package/src/roborockCommunication/Zmodel/deviceModel.ts +27 -0
- package/src/roborockCommunication/Zmodel/deviceSchema.ts +8 -0
- package/src/roborockCommunication/Zmodel/deviceStatus.ts +30 -0
- package/src/roborockCommunication/Zmodel/dockInfo.ts +9 -0
- package/src/roborockCommunication/Zmodel/home.ts +13 -0
- package/src/roborockCommunication/Zmodel/homeInfo.ts +5 -0
- package/src/roborockCommunication/Zmodel/map.ts +20 -0
- package/src/roborockCommunication/Zmodel/mapInfo.ts +54 -0
- package/src/roborockCommunication/Zmodel/messageResult.ts +75 -0
- package/src/roborockCommunication/Zmodel/multipleMap.ts +8 -0
- package/src/roborockCommunication/Zmodel/networkInfo.ts +7 -0
- package/src/roborockCommunication/Zmodel/product.ts +9 -0
- package/src/roborockCommunication/Zmodel/room.ts +4 -0
- package/src/roborockCommunication/Zmodel/roomInfo.ts +30 -0
- package/src/roborockCommunication/Zmodel/scene.ts +44 -0
- package/src/roborockCommunication/Zmodel/userData.ts +26 -0
- package/src/roborockCommunication/Zmodel/vacuumError.ts +35 -0
- package/src/roborockCommunication/broadcast/abstractClient.ts +80 -0
- package/src/roborockCommunication/broadcast/client/LocalNetworkClient.ts +218 -0
- package/src/roborockCommunication/broadcast/client/LocalNetworkUDPClient.ts +157 -0
- package/src/roborockCommunication/broadcast/client/MQTTClient.ts +174 -0
- package/src/roborockCommunication/broadcast/client.ts +19 -0
- package/src/roborockCommunication/broadcast/clientRouter.ts +104 -0
- package/src/roborockCommunication/broadcast/listener/abstractConnectionListener.ts +6 -0
- package/src/roborockCommunication/broadcast/listener/abstractMessageHandler.ts +11 -0
- package/src/roborockCommunication/broadcast/listener/abstractMessageListener.ts +5 -0
- package/src/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.ts +33 -0
- package/src/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.ts +16 -0
- package/src/roborockCommunication/broadcast/listener/implementation/connectionStateListener.ts +57 -0
- package/src/roborockCommunication/broadcast/listener/implementation/generalSyncMessageListener.ts +38 -0
- package/src/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.ts +37 -0
- package/src/roborockCommunication/broadcast/listener/implementation/syncMessageListener.ts +50 -0
- package/src/roborockCommunication/broadcast/listener/index.ts +3 -0
- package/src/roborockCommunication/broadcast/messageProcessor.ts +184 -0
- package/src/roborockCommunication/broadcast/model/contentMessage.ts +5 -0
- package/src/roborockCommunication/broadcast/model/dps.ts +19 -0
- package/src/roborockCommunication/broadcast/model/headerMessage.ts +7 -0
- package/src/roborockCommunication/broadcast/model/messageContext.ts +53 -0
- package/src/roborockCommunication/broadcast/model/protocol.ts +28 -0
- package/src/roborockCommunication/broadcast/model/requestMessage.ts +51 -0
- package/src/roborockCommunication/broadcast/model/responseMessage.ts +19 -0
- package/src/roborockCommunication/helper/chunkBuffer.ts +18 -0
- package/src/roborockCommunication/helper/cryptoHelper.ts +30 -0
- package/src/roborockCommunication/helper/messageDeserializer.ts +119 -0
- package/src/roborockCommunication/helper/messageSerializer.ts +101 -0
- package/src/roborockCommunication/helper/nameDecoder.ts +78 -0
- package/src/roborockCommunication/helper/sequence.ts +18 -0
- package/src/roborockCommunication/index.ts +25 -0
- package/src/roborockService.ts +657 -0
- package/src/runtimes/handleCloudMessage.ts +134 -0
- package/src/runtimes/handleHomeDataMessage.ts +67 -0
- package/src/runtimes/handleLocalMessage.ts +209 -0
- package/src/rvc.ts +97 -0
- package/src/settings.ts +1 -0
- package/src/share/function.ts +103 -0
- package/src/share/runtimeHelper.ts +23 -0
- package/src/tests/behaviors/roborock.vacuum/default/default.test.ts +134 -0
- package/src/tests/behaviors/roborock.vacuum/smart/runtimes.test.ts +64 -0
- package/src/tests/behaviors/roborock.vacuum/smart/smart.test.ts +215 -0
- package/src/tests/helper.test.ts +162 -0
- package/src/tests/initialData/getSupportedAreas.test.ts +181 -0
- package/src/tests/model/DockingStationStatus.test.ts +39 -0
- package/src/tests/platformRunner.test.ts +188 -0
- package/src/tests/platformRunner2.test.ts +228 -0
- package/src/tests/platformRunner3.test.ts +46 -0
- package/src/tests/roborockCommunication/RESTAPI/roborockAuthenticateApi.test.ts +144 -0
- package/src/tests/roborockCommunication/RESTAPI/roborockIoTApi.test.ts +106 -0
- package/src/tests/roborockCommunication/broadcast/client/LocalNetworkClient.test.ts +189 -0
- package/src/tests/roborockCommunication/broadcast/client/MQTTClient.test.ts +208 -0
- package/src/tests/roborockCommunication/broadcast/clientRouter.test.ts +168 -0
- package/src/tests/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.test.ts +59 -0
- package/src/tests/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.test.ts +46 -0
- package/src/tests/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.test.ts +71 -0
- package/src/tests/roborockCommunication/broadcast/listener/implementation/syncMessageListener.test.ts +86 -0
- package/src/tests/roborockCommunication/broadcast/messageProcessor.test.ts +126 -0
- package/src/tests/roborockService.setSelectedAreas.test.ts +61 -0
- package/src/tests/roborockService.test.ts +517 -0
- package/src/tests/roborockService2.test.ts +69 -0
- package/src/tests/roborockService3.test.ts +133 -0
- package/src/tests/roborockService4.test.ts +76 -0
- package/src/tests/roborockService5.test.ts +79 -0
- package/src/tests/runtimes/handleCloudMessage.test.ts +200 -0
- package/src/tests/runtimes/handleHomeDataMessage.test.ts +54 -0
- package/src/tests/runtimes/handleLocalMessage.test.ts +227 -0
- package/src/tests/testData/mockData.ts +370 -0
- package/src/tests/testData/mockHomeData-a187.json +286 -0
- package/tsconfig.jest.json +21 -0
- package/tsconfig.json +37 -0
- package/tsconfig.production.json +19 -0
- package/tslint.json +9 -0
- package/web-for-testing/README.md +47 -0
- package/web-for-testing/nodemon.json +7 -0
- package/web-for-testing/package-lock.json +6600 -0
- package/web-for-testing/package.json +36 -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
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Matterbridge Roborock Vacuum Plugin",
|
|
3
|
+
"description": "matterbridge-roborock-vacuum-plugin v. 1.1.1-rc09 by https://github.com/RinDevJunior",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["username"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "Plugin name",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"readOnly": true,
|
|
11
|
+
"ui:widget": "hidden"
|
|
12
|
+
},
|
|
13
|
+
"type": {
|
|
14
|
+
"description": "Plugin type",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"readOnly": true,
|
|
17
|
+
"ui:widget": "hidden"
|
|
18
|
+
},
|
|
19
|
+
"whiteList": {
|
|
20
|
+
"description": "(ONLY SET IF YOU HAVE MULTIPLE VACUUMS) Only THE FIRST ONE device with <Name>-<duid> in the list will be exposed. If the list is empty, THE FIRST device will be exposed.",
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"uniqueItems": true,
|
|
26
|
+
"selectFrom": "name"
|
|
27
|
+
},
|
|
28
|
+
"username": {
|
|
29
|
+
"description": "Roborock account email address",
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"region": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "Region",
|
|
35
|
+
"description": "Roborock account region (eu, us, or cn). Overrides auto-detection.",
|
|
36
|
+
"enum": ["eu", "us", "cn"]
|
|
37
|
+
},
|
|
38
|
+
"authentication": {
|
|
39
|
+
"description": "Authentication method to use",
|
|
40
|
+
"type": "object",
|
|
41
|
+
"oneOf": [
|
|
42
|
+
{
|
|
43
|
+
"title": "Verification Code",
|
|
44
|
+
"type": "object",
|
|
45
|
+
"properties": {
|
|
46
|
+
"authenticationMethod": {
|
|
47
|
+
"const": "VerificationCode",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"default": "VerificationCode",
|
|
50
|
+
"readOnly": true
|
|
51
|
+
},
|
|
52
|
+
"verificationCode": {
|
|
53
|
+
"description": "6-digit verification code sent to your email. Leave empty to request a new code, then restart the plugin after entering the code.",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"maxLength": 6
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": ["authenticationMethod"]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"title": "Password",
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"authenticationMethod": {
|
|
65
|
+
"const": "Password",
|
|
66
|
+
"type": "string",
|
|
67
|
+
"readOnly": true
|
|
68
|
+
},
|
|
69
|
+
"password": {
|
|
70
|
+
"description": "[DEPRECATED] Password login is no longer supported. Use verification code instead.",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"ui:widget": "password"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"required": ["authenticationMethod", "password"]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
"refreshInterval": {
|
|
81
|
+
"description": "Refresh interval in seconds (default: 60)",
|
|
82
|
+
"type": "number",
|
|
83
|
+
"default": 60
|
|
84
|
+
},
|
|
85
|
+
"enableExperimental": {
|
|
86
|
+
"title": "Enable the experimental feature",
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties": {
|
|
89
|
+
"enableExperimentalFeature": {
|
|
90
|
+
"title": "Enable Custom Clean Mode",
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"default": false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"allOf": [
|
|
96
|
+
{
|
|
97
|
+
"if": {
|
|
98
|
+
"properties": {
|
|
99
|
+
"enableExperimentalFeature": {
|
|
100
|
+
"const": true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"required": ["enableExperimentalFeature"]
|
|
104
|
+
},
|
|
105
|
+
"then": {
|
|
106
|
+
"properties": {
|
|
107
|
+
"advancedFeature": {
|
|
108
|
+
"title": "Enable Advanced Feature",
|
|
109
|
+
"type": "object",
|
|
110
|
+
"properties": {
|
|
111
|
+
"showRoutinesAsRoom": {
|
|
112
|
+
"title": "Show Routines As Room",
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"default": false
|
|
115
|
+
},
|
|
116
|
+
"includeDockStationStatus": {
|
|
117
|
+
"title": "Include Dock Station Status",
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"default": false
|
|
120
|
+
},
|
|
121
|
+
"forceRunAtDefault": {
|
|
122
|
+
"title": "Force Run At Default Implementation",
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"default": false
|
|
125
|
+
},
|
|
126
|
+
"useVacationModeToSendVacuumToDock": {
|
|
127
|
+
"title": "Use \"Vacation\" Mode To Send Vacuum To Dock",
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"default": false
|
|
130
|
+
},
|
|
131
|
+
"enableServerMode": {
|
|
132
|
+
"description": "Enable the Robot Vacuum Cleaner in server mode (Each vacuum will have its own server).",
|
|
133
|
+
"type": "boolean",
|
|
134
|
+
"default": false
|
|
135
|
+
},
|
|
136
|
+
"alwaysExecuteAuthentication": {
|
|
137
|
+
"description": "Always execute authentication on startup.",
|
|
138
|
+
"type": "boolean",
|
|
139
|
+
"default": false
|
|
140
|
+
},
|
|
141
|
+
"enableMultipleMap": {
|
|
142
|
+
"description": "Enable multiple maps support.",
|
|
143
|
+
"type": "boolean",
|
|
144
|
+
"default": false
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"cleanModeSettings": {
|
|
149
|
+
"title": "Enable Custom Clean Mode",
|
|
150
|
+
"type": "object",
|
|
151
|
+
"properties": {
|
|
152
|
+
"enableCleanModeMapping": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"default": false
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"allOf": [
|
|
158
|
+
{
|
|
159
|
+
"if": {
|
|
160
|
+
"properties": {
|
|
161
|
+
"enableCleanModeMapping": {
|
|
162
|
+
"const": true
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"required": ["enableCleanModeMapping"]
|
|
166
|
+
},
|
|
167
|
+
"then": {
|
|
168
|
+
"properties": {
|
|
169
|
+
"vacuuming": {
|
|
170
|
+
"title": "Vacuuming only",
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"fanMode": {
|
|
174
|
+
"$ref": "#/$defs/fanMode",
|
|
175
|
+
"default": "Balanced"
|
|
176
|
+
},
|
|
177
|
+
"mopRouteMode": {
|
|
178
|
+
"$ref": "#/$defs/mopRouteMode"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"mopping": {
|
|
183
|
+
"title": "Mopping only",
|
|
184
|
+
"type": "object",
|
|
185
|
+
"properties": {
|
|
186
|
+
"waterFlowMode": {
|
|
187
|
+
"$ref": "#/$defs/waterFlowMode"
|
|
188
|
+
},
|
|
189
|
+
"mopRouteMode": {
|
|
190
|
+
"$ref": "#/$defs/mopRouteMode"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"allOf": [
|
|
194
|
+
{
|
|
195
|
+
"if": {
|
|
196
|
+
"properties": {
|
|
197
|
+
"waterFlowMode": {
|
|
198
|
+
"const": "CustomizeWithDistanceOff"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"then": {
|
|
203
|
+
"properties": {
|
|
204
|
+
"distanceOff": {
|
|
205
|
+
"type": "number",
|
|
206
|
+
"description": "Distance Off - Default = 25",
|
|
207
|
+
"default": 25
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"required": ["distanceOff"]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"vacmop": {
|
|
216
|
+
"title": "Vacuuming and Mopping",
|
|
217
|
+
"type": "object",
|
|
218
|
+
"properties": {
|
|
219
|
+
"fanMode": {
|
|
220
|
+
"$ref": "#/$defs/fanMode",
|
|
221
|
+
"default": "Balanced"
|
|
222
|
+
},
|
|
223
|
+
"waterFlowMode": {
|
|
224
|
+
"$ref": "#/$defs/waterFlowMode"
|
|
225
|
+
},
|
|
226
|
+
"mopRouteMode": {
|
|
227
|
+
"$ref": "#/$defs/mopRouteMode"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"allOf": [
|
|
231
|
+
{
|
|
232
|
+
"if": {
|
|
233
|
+
"properties": {
|
|
234
|
+
"waterFlowMode": {
|
|
235
|
+
"const": "CustomizeWithDistanceOff"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"then": {
|
|
240
|
+
"properties": {
|
|
241
|
+
"distanceOff": {
|
|
242
|
+
"type": "number",
|
|
243
|
+
"description": "Distance Off - Default = 25",
|
|
244
|
+
"default": 25
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"required": ["distanceOff"]
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
"debug": {
|
|
263
|
+
"description": "Enable the debug for the plugin (development only)",
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"default": false
|
|
266
|
+
},
|
|
267
|
+
"unregisterOnShutdown": {
|
|
268
|
+
"description": "Unregister all devices on shutdown (development only)",
|
|
269
|
+
"type": "boolean",
|
|
270
|
+
"default": false
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"$defs": {
|
|
274
|
+
"fanMode": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"description": "Suction power mode to use (e.g., 'Quiet', 'Balanced', 'Turbo', 'Max', 'MaxPlus').",
|
|
277
|
+
"enum": ["Quiet", "Balanced", "Turbo", "Max", "MaxPlus"],
|
|
278
|
+
"default": "Balanced"
|
|
279
|
+
},
|
|
280
|
+
"waterFlowMode": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"description": "Water flow mode to use (e.g., 'Low', 'Medium', 'High', 'CustomizeWithDistanceOff').",
|
|
283
|
+
"enum": ["Low", "Medium", "High", "CustomizeWithDistanceOff"],
|
|
284
|
+
"default": "Medium"
|
|
285
|
+
},
|
|
286
|
+
"mopRouteMode": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"description": "Mop route intensity to use (e.g., 'Standard', 'Deep', 'DeepPlus', 'Fast').",
|
|
289
|
+
"enum": ["Standard", "Deep", "DeepPlus", "Fast"],
|
|
290
|
+
"default": "Standard"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
package/misc/status.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Status Message
|
|
2
|
+
|
|
3
|
+
### Response
|
|
4
|
+
|
|
5
|
+
| Key | Example | Description | Only available for |
|
|
6
|
+
| --------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
|
7
|
+
| `battery` | _100_ | Battery level (in %) | |
|
|
8
|
+
| `clean_area` | _140000_ | Total area (in cm²) | |
|
|
9
|
+
| `clean_time` | _15_ | Total cleaning time (in s) | |
|
|
10
|
+
| `dnd_enabled` | _0_ | Is 'Do Not Disturb' enabled (0=disabled, 1=enabled) | |
|
|
11
|
+
| `error_code` | _0_ | Error code (see [list](#error-codes) below) | |
|
|
12
|
+
| `fan_power` | _102_ | Fan power, corresponds to the values in [Custom Mode](../README_CLEANMODE.md) | |
|
|
13
|
+
| `in_cleaning` | _0_ | Is device cleaning | |
|
|
14
|
+
| `in_fresh_state` | _1_ | ? | |
|
|
15
|
+
| `in_returning` | _0_ | Is returning to dock (0=no, 1=yes) | |
|
|
16
|
+
| `is_locating` | _0_ | ? | |
|
|
17
|
+
| `lab_status` | _1_ | ? | |
|
|
18
|
+
| `lock_status` | _0_ | ? | |
|
|
19
|
+
| `map_present` | _1_ | Is map present | |
|
|
20
|
+
| `map_status` | _3_ | ? | |
|
|
21
|
+
| `mop_forbidden_enable` | _0_ | ? | |
|
|
22
|
+
| `msg_seq` | _52_ | Message sequence increments with each request | |
|
|
23
|
+
| `msg_ver` | _2_ | Message version (seems always 4 and 2 for s6) see below for other examples | |
|
|
24
|
+
| `state` | _8_ | Status code (see [list](#status-codes) below) | |
|
|
25
|
+
| `water_box_carriage_status` | _0_ | Is carriage mounted (0=no, 1=yes) | |
|
|
26
|
+
| `water_box_mode` | _204_ | Water quantity control, | |
|
|
27
|
+
| `water_box_status` | _1_ | Is water tank mounted (0=no, 1=yes) | |
|
|
28
|
+
|
|
29
|
+
#### Example
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"result": [{
|
|
34
|
+
"msg_ver": 2,
|
|
35
|
+
"msg_seq": 52,
|
|
36
|
+
"state": 8,
|
|
37
|
+
"battery": 100,
|
|
38
|
+
"clean_time": 15,
|
|
39
|
+
"clean_area": 140000,
|
|
40
|
+
"error_code": 0,
|
|
41
|
+
"map_present": 1,
|
|
42
|
+
"in_cleaning": 0,
|
|
43
|
+
"in_returning": 0,
|
|
44
|
+
"in_fresh_state": 1,
|
|
45
|
+
"lab_status": 1,
|
|
46
|
+
"water_box_status": 1,
|
|
47
|
+
"fan_power": 102,
|
|
48
|
+
"dnd_enabled": 0,
|
|
49
|
+
"map_status": 3,
|
|
50
|
+
"is_locating": 0,
|
|
51
|
+
"lock_status": 0,
|
|
52
|
+
"water_box_mode": 204,
|
|
53
|
+
"water_box_carriage_status": 0,
|
|
54
|
+
"mop_forbidden_enable": 0
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"id": 96
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Codes
|
|
62
|
+
|
|
63
|
+
### Status Codes
|
|
64
|
+
|
|
65
|
+
| Code | Description |
|
|
66
|
+
| ---- | -------------- |
|
|
67
|
+
| 0 | Unknown |
|
|
68
|
+
| 1 | Initiating |
|
|
69
|
+
| 2 | Sleeping |
|
|
70
|
+
| 3 | Idle |
|
|
71
|
+
| 4 | Remote Control |
|
|
72
|
+
| 5 | Cleaning |
|
|
73
|
+
| 6 | Returning Dock |
|
|
74
|
+
| 7 | Manual Mode |
|
|
75
|
+
| 8 | Charging |
|
|
76
|
+
| 9 | Charging Error |
|
|
77
|
+
| 10 | Paused |
|
|
78
|
+
| 11 | Spot Cleaning |
|
|
79
|
+
| 12 | In Error |
|
|
80
|
+
| 13 | Shutting Down |
|
|
81
|
+
| 14 | Updating |
|
|
82
|
+
| 15 | Docking |
|
|
83
|
+
| 16 | Go To |
|
|
84
|
+
| 17 | Zone Clean |
|
|
85
|
+
| 18 | Room Clean |
|
|
86
|
+
| 100 | Fully Charged |
|
|
87
|
+
|
|
88
|
+
### Error Codes
|
|
89
|
+
|
|
90
|
+
| Code | Description |
|
|
91
|
+
| ---- | ------------------------------------- |
|
|
92
|
+
| 0 | No error |
|
|
93
|
+
| 1 | Laser sensor fault |
|
|
94
|
+
| 2 | Collision sensor fault |
|
|
95
|
+
| 3 | Wheel floating |
|
|
96
|
+
| 4 | Cliff sensor fault |
|
|
97
|
+
| 5 | Main brush blocked |
|
|
98
|
+
| 6 | Side brush blocked |
|
|
99
|
+
| 7 | Wheel blocked |
|
|
100
|
+
| 8 | Device stuck |
|
|
101
|
+
| 9 | Dust bin missing |
|
|
102
|
+
| 10 | Filter blocked |
|
|
103
|
+
| 11 | Magnetic field detected |
|
|
104
|
+
| 12 | Low battery |
|
|
105
|
+
| 13 | Charging problem |
|
|
106
|
+
| 14 | Battery failure |
|
|
107
|
+
| 15 | Wall sensor fault |
|
|
108
|
+
| 16 | Uneven surface |
|
|
109
|
+
| 17 | Side brush failure |
|
|
110
|
+
| 18 | Suction fan failure |
|
|
111
|
+
| 19 | Unpowered charging station |
|
|
112
|
+
| 20 | Unknown Error |
|
|
113
|
+
| 21 | Laser pressure sensor problem |
|
|
114
|
+
| 22 | Charge sensor problem |
|
|
115
|
+
| 23 | Dock problem |
|
|
116
|
+
| 24 | No-go zone or invisible wall detected |
|
|
117
|
+
| 254 | Bin full |
|
|
118
|
+
| 255 | Internal error |
|
|
119
|
+
| -1 | Unknown Error |
|
package/package.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "matterbridge-roborock-vacuum-plugin-regions",
|
|
3
|
+
"version": "1.1.1-jb.1",
|
|
4
|
+
"description": "Matterbridge Roborock Vacuum Plugin (Forked for testing)",
|
|
5
|
+
"author": "https://github.com/RinDevJunior",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/RinDevJunior/matterbridge-roborock-vacuum-plugin",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/RinDevJunior/matterbridge-roborock-vacuum-plugin.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/RinDevJunior/matterbridge-roborock-vacuum-plugin/issues"
|
|
19
|
+
},
|
|
20
|
+
"funding": {
|
|
21
|
+
"type": "buymeacoffee",
|
|
22
|
+
"url": "https://www.google.com/"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"matterbridge",
|
|
26
|
+
"roborock",
|
|
27
|
+
"matter",
|
|
28
|
+
"matter.js",
|
|
29
|
+
"plugin",
|
|
30
|
+
"homekit",
|
|
31
|
+
"apple home"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"precondition": "npm install -g matterbridge@3.4.5",
|
|
38
|
+
"deepCleanB": "npm run deepClean && npm install && npm link matterbridge && npm run build && npm run matterbridge:add",
|
|
39
|
+
"start": "tsc && matterbridge -childbridge",
|
|
40
|
+
"buildpackage": "cd .. && tar --exclude-from='matterbridge-roborock-vacuum-plugin/.tarignore' -czvf matterbridge-roborock-vacuum-plugin-jb-1.1.1-jb.1.tgz matterbridge-roborock-vacuum-plugin && cd matterbridge-roborock-vacuum-plugin",
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"buildProduction": "tsc --project tsconfig.production.json",
|
|
43
|
+
"watch": "tsc --watch",
|
|
44
|
+
"start-matterbridge": "matterbridge",
|
|
45
|
+
"start:bridge": "matterbridge -bridge",
|
|
46
|
+
"start:childbridge": "matterbridge -childbridge",
|
|
47
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
48
|
+
"test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose",
|
|
49
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
50
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose --coverage",
|
|
51
|
+
"test:index": "node --experimental-vm-modules node_modules/jest/bin/jest.js index.test.ts --verbose --coverage",
|
|
52
|
+
"test:platform": "node --experimental-vm-modules node_modules/jest/bin/jest.js platform.test.ts --verbose --coverage",
|
|
53
|
+
"lint": "eslint --max-warnings=0 .",
|
|
54
|
+
"lint:fix": "eslint --fix --max-warnings=0 .",
|
|
55
|
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
56
|
+
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
57
|
+
"clean": "npx rimraf tsconfig.tsbuildinfo ./dist",
|
|
58
|
+
"cleanBuild": "npm run clean && npm run build",
|
|
59
|
+
"cleanBuildProduction": "npm run clean && npm run buildProduction",
|
|
60
|
+
"deepClean": "npx rimraf tsconfig.tsbuildinfo package-lock.json npm-shrinkwrap.json ./dist ./node_modules",
|
|
61
|
+
"deepCleanBuild": "npm run deepClean && npm install && npm link matterbridge && npm run build",
|
|
62
|
+
"checkDependencies": "npx npm-check-updates",
|
|
63
|
+
"updateDependencies": "npx npm-check-updates -u && npm run deepCleanBuild",
|
|
64
|
+
"git:status": "git status && git branch -vv && git diff main origin/main",
|
|
65
|
+
"git:hardreset": "git fetch origin && git checkout main && git reset --hard origin/main",
|
|
66
|
+
"prepublishOnly": "npm run cleanBuildProduction",
|
|
67
|
+
"runMeBeforePublish": "npm run lint && npm run format && npm run build && npm run test",
|
|
68
|
+
"npmPack": "copy package.json package.log && npm run prepublishOnly && npm pack && copy package.log package.json && npm run deepCleanBuild",
|
|
69
|
+
"npmPublishTagDev": "copy package.json package.log && npm run prepublishOnly && npm publish --tag dev && copy package.log package.json && npm run deepCleanBuild",
|
|
70
|
+
"npmPublishTagEdge": "copy package.json package.log && npm run prepublishOnly && npm publish --tag edge && copy package.log package.json && npm run deepCleanBuild",
|
|
71
|
+
"npmPublishTagLatest": "copy package.json package.log && npm run prepublishOnly && npm publish --tag latest && copy package.log package.json && npm run deepCleanBuild",
|
|
72
|
+
"matterbridge:add": "matterbridge -add .\\",
|
|
73
|
+
"matterbridge:remove": "matterbridge -remove .\\",
|
|
74
|
+
"matterbridge:enable": "matterbridge -enable .\\",
|
|
75
|
+
"matterbridge:disable": "matterbridge -disable .\\",
|
|
76
|
+
"matterbridge:list": "matterbridge -list",
|
|
77
|
+
"dev:link": "npm link matterbridge",
|
|
78
|
+
"dev:unlink": "npm unlink matterbridge",
|
|
79
|
+
"install:dependencies": "npm install node-ansi-logger node-persist-manager --omit=dev",
|
|
80
|
+
"install:typescript": "npm install typescript @types/node --save-dev --omit=dev",
|
|
81
|
+
"install:eslint": "npm uninstall eslint @types/eslint__js && npm install --save-dev @eslint/js typescript-eslint eslint-plugin-n && npm run lint",
|
|
82
|
+
"install:prettier": "npm install prettier eslint-config-prettier eslint-plugin-prettier --save-dev --omit=dev",
|
|
83
|
+
"install:jest": "npm install jest ts-jest @types/jest eslint-plugin-jest --save-dev --omit=dev"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@eslint/js": "9.26.0",
|
|
87
|
+
"@tsconfig/node16": "^16.1.3",
|
|
88
|
+
"@types/jest": "^30.0.0",
|
|
89
|
+
"@types/node": "22.15.18",
|
|
90
|
+
"eslint-config-prettier": "10.1.5",
|
|
91
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
92
|
+
"eslint-plugin-n": "17.18.0",
|
|
93
|
+
"eslint-plugin-prettier": "5.4.0",
|
|
94
|
+
"jest": "^30.0.5",
|
|
95
|
+
"prettier": "3.5.3",
|
|
96
|
+
"ts-jest": "^29.4.1",
|
|
97
|
+
"tslint": "^5.20.1",
|
|
98
|
+
"typescript": "^5.8.3",
|
|
99
|
+
"typescript-eslint": "8.32.1"
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@log4js-node/log4js-api": "^1.0.2",
|
|
103
|
+
"@types/node-persist": "^3.1.8",
|
|
104
|
+
"axios": "^1.9.0",
|
|
105
|
+
"binary-parser": "^2.2.1",
|
|
106
|
+
"crc-32": "^1.2.2",
|
|
107
|
+
"jimp": "^1.6.0",
|
|
108
|
+
"mqtt": "^5.13.0",
|
|
109
|
+
"node-persist-manager": "1.0.8"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/*
|
|
3
|
+
|
|
4
|
+
prettier.config.js
|
|
5
|
+
|
|
6
|
+
Prettier:
|
|
7
|
+
|
|
8
|
+
How to install:
|
|
9
|
+
npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Add package.json scripts:
|
|
13
|
+
*/
|
|
14
|
+
// "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
15
|
+
// "format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
|
|
19
|
+
Add .prettierignore
|
|
20
|
+
|
|
21
|
+
# Ignore artifacts:
|
|
22
|
+
dist
|
|
23
|
+
node_modules
|
|
24
|
+
build
|
|
25
|
+
coverage
|
|
26
|
+
|
|
27
|
+
# Ignore all HTML files:
|
|
28
|
+
*/
|
|
29
|
+
// **/*.html
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
printWidth: 180, // default 80
|
|
33
|
+
tabWidth: 2,
|
|
34
|
+
useTabs: false,
|
|
35
|
+
semi: true,
|
|
36
|
+
singleQuote: true, // default false
|
|
37
|
+
quoteProps: 'preserve', // default 'as-needed'
|
|
38
|
+
jsxSingleQuote: false,
|
|
39
|
+
trailingComma: 'all',
|
|
40
|
+
bracketSpacing: true,
|
|
41
|
+
bracketSameLine: false,
|
|
42
|
+
arrowParens: 'always',
|
|
43
|
+
requirePragma: false,
|
|
44
|
+
insertPragma: false,
|
|
45
|
+
proseWrap: 'preserve',
|
|
46
|
+
endOfLine: 'lf',
|
|
47
|
+
embeddedLanguageFormatting: 'off', // default 'auto'
|
|
48
|
+
singleAttributePerLine: false,
|
|
49
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnsiLogger } from 'matterbridge/logger';
|
|
2
|
+
import { BehaviorDeviceGeneric } from './behaviors/BehaviorDeviceGeneric.js';
|
|
3
|
+
import RoborockService from './roborockService.js';
|
|
4
|
+
import { DefaultEndpointCommands, setDefaultCommandHandler } from './behaviors/roborock.vacuum/default/default.js';
|
|
5
|
+
import { DeviceModel } from './roborockCommunication/Zmodel/deviceModel.js';
|
|
6
|
+
import { CleanModeSettings } from './model/ExperimentalFeatureSetting.js';
|
|
7
|
+
import { EndpointCommandsSmart, setCommandHandlerSmart } from './behaviors/roborock.vacuum/smart/smart.js';
|
|
8
|
+
|
|
9
|
+
export type BehaviorFactoryResult = BehaviorDeviceGeneric<DefaultEndpointCommands> | BehaviorDeviceGeneric<EndpointCommandsSmart>;
|
|
10
|
+
|
|
11
|
+
export function configurateBehavior(
|
|
12
|
+
model: string,
|
|
13
|
+
duid: string,
|
|
14
|
+
roborockService: RoborockService,
|
|
15
|
+
cleanModeSettings: CleanModeSettings | undefined,
|
|
16
|
+
forceRunAtDefault: boolean,
|
|
17
|
+
logger: AnsiLogger,
|
|
18
|
+
): BehaviorFactoryResult {
|
|
19
|
+
if (forceRunAtDefault) {
|
|
20
|
+
const deviceHandler = new BehaviorDeviceGeneric<DefaultEndpointCommands>(logger);
|
|
21
|
+
setDefaultCommandHandler(duid, deviceHandler, logger, roborockService, cleanModeSettings);
|
|
22
|
+
return deviceHandler;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (model) {
|
|
26
|
+
case DeviceModel.QREVO_EDGE_5V1: {
|
|
27
|
+
const deviceHandler = new BehaviorDeviceGeneric<EndpointCommandsSmart>(logger);
|
|
28
|
+
setCommandHandlerSmart(duid, deviceHandler, logger, roborockService, cleanModeSettings);
|
|
29
|
+
return deviceHandler;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
case DeviceModel.S7_MAXV:
|
|
33
|
+
case DeviceModel.S8_PRO_ULTRA:
|
|
34
|
+
case DeviceModel.S6_PURE:
|
|
35
|
+
default: {
|
|
36
|
+
const deviceHandler = new BehaviorDeviceGeneric<DefaultEndpointCommands>(logger);
|
|
37
|
+
setDefaultCommandHandler(duid, deviceHandler, logger, roborockService, cleanModeSettings);
|
|
38
|
+
return deviceHandler;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AnsiLogger } from 'matterbridge/logger';
|
|
2
|
+
import { Behavior, MaybePromise } from 'matterbridge/matter';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
export type DeviceCommandHandler = (...args: any[]) => MaybePromise;
|
|
6
|
+
|
|
7
|
+
export type DeviceCommands = Record<string, DeviceCommandHandler>;
|
|
8
|
+
|
|
9
|
+
export class BehaviorDeviceGeneric<Commands extends DeviceCommands> {
|
|
10
|
+
readonly commands: Partial<Commands> = {};
|
|
11
|
+
constructor(readonly log: AnsiLogger) {}
|
|
12
|
+
|
|
13
|
+
setCommandHandler<Command extends keyof Commands>(command: Command, handler: Commands[Command]): void {
|
|
14
|
+
if (this.commands[command]) throw new Error(`Handler already registered for command ${String(command)}`);
|
|
15
|
+
this.commands[command] = handler;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async executeCommand<Command extends keyof Commands>(command: Command, ...args: Parameters<Commands[Command]>): Promise<void> {
|
|
19
|
+
const handler = this.commands[command];
|
|
20
|
+
if (!handler) throw new Error(`${String(command)} not implemented`);
|
|
21
|
+
await (handler as DeviceCommandHandler)(...args);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class BehaviorRoborock extends Behavior {
|
|
26
|
+
static override readonly id = 'roborock.vacuum.axx';
|
|
27
|
+
declare state: BehaviorRoborockState;
|
|
28
|
+
}
|
|
29
|
+
export interface BehaviorRoborockState {
|
|
30
|
+
device: BehaviorDeviceGeneric<DeviceCommands>;
|
|
31
|
+
}
|