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.
Files changed (261) hide show
  1. package/.github/workflows/build.yml +56 -0
  2. package/.github/workflows/coverage.yml +59 -0
  3. package/.github/workflows/publish.yml +37 -0
  4. package/.tarignore +5 -0
  5. package/CHANGELOG.md +62 -0
  6. package/LICENSE +202 -0
  7. package/README.md +135 -0
  8. package/README_CLEANMODE.md +29 -0
  9. package/README_DEV.md +75 -0
  10. package/README_REPORT_ISSUE.md +34 -0
  11. package/README_SUPPORTED.md +67 -0
  12. package/dist/behaviorFactory.js +26 -0
  13. package/dist/behaviors/BehaviorDeviceGeneric.js +22 -0
  14. package/dist/behaviors/roborock.vacuum/default/default.js +183 -0
  15. package/dist/behaviors/roborock.vacuum/default/initalData.js +143 -0
  16. package/dist/behaviors/roborock.vacuum/default/runtimes.js +21 -0
  17. package/dist/behaviors/roborock.vacuum/smart/initalData.js +18 -0
  18. package/dist/behaviors/roborock.vacuum/smart/runtimes.js +11 -0
  19. package/dist/behaviors/roborock.vacuum/smart/smart.js +119 -0
  20. package/dist/clientManager.js +17 -0
  21. package/dist/helper.js +76 -0
  22. package/dist/index.js +4 -0
  23. package/dist/initialData/getBatteryStatus.js +24 -0
  24. package/dist/initialData/getOperationalStates.js +82 -0
  25. package/dist/initialData/getSupportedAreas.js +120 -0
  26. package/dist/initialData/getSupportedCleanModes.js +17 -0
  27. package/dist/initialData/getSupportedRunModes.js +11 -0
  28. package/dist/initialData/getSupportedScenes.js +26 -0
  29. package/dist/initialData/index.js +6 -0
  30. package/dist/model/CloudMessageModel.js +1 -0
  31. package/dist/model/DockingStationStatus.js +26 -0
  32. package/dist/model/ExperimentalFeatureSetting.js +30 -0
  33. package/dist/model/RoomMap.js +19 -0
  34. package/dist/model/roomIndexMap.js +21 -0
  35. package/dist/notifyMessageTypes.js +9 -0
  36. package/dist/platform.js +312 -0
  37. package/dist/platformRunner.js +90 -0
  38. package/dist/roborockCommunication/RESTAPI/roborockAuthenticateApi.js +213 -0
  39. package/dist/roborockCommunication/RESTAPI/roborockIoTApi.js +95 -0
  40. package/dist/roborockCommunication/Zenum/additionalPropCode.js +4 -0
  41. package/dist/roborockCommunication/Zenum/authenticateResponseCode.js +7 -0
  42. package/dist/roborockCommunication/Zenum/dockType.js +4 -0
  43. package/dist/roborockCommunication/Zenum/operationStatusCode.js +44 -0
  44. package/dist/roborockCommunication/Zenum/vacuumAndDockErrorCode.js +68 -0
  45. package/dist/roborockCommunication/Zmodel/apiResponse.js +1 -0
  46. package/dist/roborockCommunication/Zmodel/authenticateFlowState.js +1 -0
  47. package/dist/roborockCommunication/Zmodel/authenticateResponse.js +1 -0
  48. package/dist/roborockCommunication/Zmodel/baseURL.js +1 -0
  49. package/dist/roborockCommunication/Zmodel/batteryMessage.js +1 -0
  50. package/dist/roborockCommunication/Zmodel/device.js +1 -0
  51. package/dist/roborockCommunication/Zmodel/deviceModel.js +28 -0
  52. package/dist/roborockCommunication/Zmodel/deviceSchema.js +1 -0
  53. package/dist/roborockCommunication/Zmodel/deviceStatus.js +22 -0
  54. package/dist/roborockCommunication/Zmodel/dockInfo.js +6 -0
  55. package/dist/roborockCommunication/Zmodel/home.js +1 -0
  56. package/dist/roborockCommunication/Zmodel/homeInfo.js +1 -0
  57. package/dist/roborockCommunication/Zmodel/map.js +1 -0
  58. package/dist/roborockCommunication/Zmodel/mapInfo.js +29 -0
  59. package/dist/roborockCommunication/Zmodel/messageResult.js +7 -0
  60. package/dist/roborockCommunication/Zmodel/multipleMap.js +1 -0
  61. package/dist/roborockCommunication/Zmodel/networkInfo.js +1 -0
  62. package/dist/roborockCommunication/Zmodel/product.js +1 -0
  63. package/dist/roborockCommunication/Zmodel/room.js +1 -0
  64. package/dist/roborockCommunication/Zmodel/roomInfo.js +22 -0
  65. package/dist/roborockCommunication/Zmodel/scene.js +16 -0
  66. package/dist/roborockCommunication/Zmodel/userData.js +1 -0
  67. package/dist/roborockCommunication/Zmodel/vacuumError.js +27 -0
  68. package/dist/roborockCommunication/broadcast/abstractClient.js +55 -0
  69. package/dist/roborockCommunication/broadcast/client/LocalNetworkClient.js +174 -0
  70. package/dist/roborockCommunication/broadcast/client/LocalNetworkUDPClient.js +129 -0
  71. package/dist/roborockCommunication/broadcast/client/MQTTClient.js +139 -0
  72. package/dist/roborockCommunication/broadcast/client.js +1 -0
  73. package/dist/roborockCommunication/broadcast/clientRouter.js +82 -0
  74. package/dist/roborockCommunication/broadcast/listener/abstractConnectionListener.js +1 -0
  75. package/dist/roborockCommunication/broadcast/listener/abstractMessageHandler.js +1 -0
  76. package/dist/roborockCommunication/broadcast/listener/abstractMessageListener.js +1 -0
  77. package/dist/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.js +26 -0
  78. package/dist/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.js +11 -0
  79. package/dist/roborockCommunication/broadcast/listener/implementation/connectionStateListener.js +43 -0
  80. package/dist/roborockCommunication/broadcast/listener/implementation/generalSyncMessageListener.js +28 -0
  81. package/dist/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.js +27 -0
  82. package/dist/roborockCommunication/broadcast/listener/implementation/syncMessageListener.js +33 -0
  83. package/dist/roborockCommunication/broadcast/listener/index.js +1 -0
  84. package/dist/roborockCommunication/broadcast/messageProcessor.js +148 -0
  85. package/dist/roborockCommunication/broadcast/model/contentMessage.js +1 -0
  86. package/dist/roborockCommunication/broadcast/model/dps.js +1 -0
  87. package/dist/roborockCommunication/broadcast/model/headerMessage.js +1 -0
  88. package/dist/roborockCommunication/broadcast/model/messageContext.js +37 -0
  89. package/dist/roborockCommunication/broadcast/model/protocol.js +28 -0
  90. package/dist/roborockCommunication/broadcast/model/requestMessage.js +38 -0
  91. package/dist/roborockCommunication/broadcast/model/responseMessage.js +14 -0
  92. package/dist/roborockCommunication/helper/chunkBuffer.js +17 -0
  93. package/dist/roborockCommunication/helper/cryptoHelper.js +23 -0
  94. package/dist/roborockCommunication/helper/messageDeserializer.js +98 -0
  95. package/dist/roborockCommunication/helper/messageSerializer.js +84 -0
  96. package/dist/roborockCommunication/helper/nameDecoder.js +66 -0
  97. package/dist/roborockCommunication/helper/sequence.js +16 -0
  98. package/dist/roborockCommunication/index.js +13 -0
  99. package/dist/roborockService.js +494 -0
  100. package/dist/runtimes/handleCloudMessage.js +110 -0
  101. package/dist/runtimes/handleHomeDataMessage.js +57 -0
  102. package/dist/runtimes/handleLocalMessage.js +169 -0
  103. package/dist/rvc.js +51 -0
  104. package/dist/settings.js +1 -0
  105. package/dist/share/function.js +93 -0
  106. package/dist/share/runtimeHelper.js +17 -0
  107. package/dist/tests/testData/mockData.js +359 -0
  108. package/eslint.config.js +80 -0
  109. package/jest.config.js +22 -0
  110. package/jest.setup.js +2 -0
  111. package/logo.png +0 -0
  112. package/matterbridge-roborock-vacuum-plugin.config.json +46 -0
  113. package/matterbridge-roborock-vacuum-plugin.schema.json +293 -0
  114. package/misc/status.md +119 -0
  115. package/package.json +111 -0
  116. package/prettier.config.js +49 -0
  117. package/screenshot/IMG_1.PNG +0 -0
  118. package/screenshot/IMG_2.PNG +0 -0
  119. package/screenshot/IMG_3.PNG +0 -0
  120. package/screenshot/IMG_4.PNG +0 -0
  121. package/screenshot/IMG_5.PNG +0 -0
  122. package/screenshot/IMG_6.PNG +0 -0
  123. package/screenshot/IMG_7.PNG +0 -0
  124. package/src/behaviorFactory.ts +41 -0
  125. package/src/behaviors/BehaviorDeviceGeneric.ts +31 -0
  126. package/src/behaviors/roborock.vacuum/default/default.ts +238 -0
  127. package/src/behaviors/roborock.vacuum/default/initalData.ts +152 -0
  128. package/src/behaviors/roborock.vacuum/default/runtimes.ts +23 -0
  129. package/src/behaviors/roborock.vacuum/smart/initalData.ts +20 -0
  130. package/src/behaviors/roborock.vacuum/smart/runtimes.ts +15 -0
  131. package/src/behaviors/roborock.vacuum/smart/smart.ts +159 -0
  132. package/src/clientManager.ts +23 -0
  133. package/src/helper.ts +97 -0
  134. package/src/index.ts +16 -0
  135. package/src/initialData/getBatteryStatus.ts +26 -0
  136. package/src/initialData/getOperationalStates.ts +94 -0
  137. package/src/initialData/getSupportedAreas.ts +162 -0
  138. package/src/initialData/getSupportedCleanModes.ts +22 -0
  139. package/src/initialData/getSupportedRunModes.ts +14 -0
  140. package/src/initialData/getSupportedScenes.ts +32 -0
  141. package/src/initialData/index.ts +6 -0
  142. package/src/model/CloudMessageModel.ts +11 -0
  143. package/src/model/DockingStationStatus.ts +41 -0
  144. package/src/model/ExperimentalFeatureSetting.ts +77 -0
  145. package/src/model/RoomMap.ts +38 -0
  146. package/src/model/roomIndexMap.ts +26 -0
  147. package/src/notifyMessageTypes.ts +8 -0
  148. package/src/platform.ts +424 -0
  149. package/src/platformRunner.ts +103 -0
  150. package/src/roborockCommunication/RESTAPI/roborockAuthenticateApi.ts +302 -0
  151. package/src/roborockCommunication/RESTAPI/roborockIoTApi.ts +107 -0
  152. package/src/roborockCommunication/Zenum/additionalPropCode.ts +3 -0
  153. package/src/roborockCommunication/Zenum/authenticateResponseCode.ts +6 -0
  154. package/src/roborockCommunication/Zenum/dockType.ts +3 -0
  155. package/src/roborockCommunication/Zenum/operationStatusCode.ts +43 -0
  156. package/src/roborockCommunication/Zenum/vacuumAndDockErrorCode.ts +68 -0
  157. package/src/roborockCommunication/Zmodel/apiResponse.ts +3 -0
  158. package/src/roborockCommunication/Zmodel/authenticateFlowState.ts +6 -0
  159. package/src/roborockCommunication/Zmodel/authenticateResponse.ts +5 -0
  160. package/src/roborockCommunication/Zmodel/baseURL.ts +5 -0
  161. package/src/roborockCommunication/Zmodel/batteryMessage.ts +16 -0
  162. package/src/roborockCommunication/Zmodel/device.ts +50 -0
  163. package/src/roborockCommunication/Zmodel/deviceModel.ts +27 -0
  164. package/src/roborockCommunication/Zmodel/deviceSchema.ts +8 -0
  165. package/src/roborockCommunication/Zmodel/deviceStatus.ts +30 -0
  166. package/src/roborockCommunication/Zmodel/dockInfo.ts +9 -0
  167. package/src/roborockCommunication/Zmodel/home.ts +13 -0
  168. package/src/roborockCommunication/Zmodel/homeInfo.ts +5 -0
  169. package/src/roborockCommunication/Zmodel/map.ts +20 -0
  170. package/src/roborockCommunication/Zmodel/mapInfo.ts +54 -0
  171. package/src/roborockCommunication/Zmodel/messageResult.ts +75 -0
  172. package/src/roborockCommunication/Zmodel/multipleMap.ts +8 -0
  173. package/src/roborockCommunication/Zmodel/networkInfo.ts +7 -0
  174. package/src/roborockCommunication/Zmodel/product.ts +9 -0
  175. package/src/roborockCommunication/Zmodel/room.ts +4 -0
  176. package/src/roborockCommunication/Zmodel/roomInfo.ts +30 -0
  177. package/src/roborockCommunication/Zmodel/scene.ts +44 -0
  178. package/src/roborockCommunication/Zmodel/userData.ts +26 -0
  179. package/src/roborockCommunication/Zmodel/vacuumError.ts +35 -0
  180. package/src/roborockCommunication/broadcast/abstractClient.ts +80 -0
  181. package/src/roborockCommunication/broadcast/client/LocalNetworkClient.ts +218 -0
  182. package/src/roborockCommunication/broadcast/client/LocalNetworkUDPClient.ts +157 -0
  183. package/src/roborockCommunication/broadcast/client/MQTTClient.ts +174 -0
  184. package/src/roborockCommunication/broadcast/client.ts +19 -0
  185. package/src/roborockCommunication/broadcast/clientRouter.ts +104 -0
  186. package/src/roborockCommunication/broadcast/listener/abstractConnectionListener.ts +6 -0
  187. package/src/roborockCommunication/broadcast/listener/abstractMessageHandler.ts +11 -0
  188. package/src/roborockCommunication/broadcast/listener/abstractMessageListener.ts +5 -0
  189. package/src/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.ts +33 -0
  190. package/src/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.ts +16 -0
  191. package/src/roborockCommunication/broadcast/listener/implementation/connectionStateListener.ts +57 -0
  192. package/src/roborockCommunication/broadcast/listener/implementation/generalSyncMessageListener.ts +38 -0
  193. package/src/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.ts +37 -0
  194. package/src/roborockCommunication/broadcast/listener/implementation/syncMessageListener.ts +50 -0
  195. package/src/roborockCommunication/broadcast/listener/index.ts +3 -0
  196. package/src/roborockCommunication/broadcast/messageProcessor.ts +184 -0
  197. package/src/roborockCommunication/broadcast/model/contentMessage.ts +5 -0
  198. package/src/roborockCommunication/broadcast/model/dps.ts +19 -0
  199. package/src/roborockCommunication/broadcast/model/headerMessage.ts +7 -0
  200. package/src/roborockCommunication/broadcast/model/messageContext.ts +53 -0
  201. package/src/roborockCommunication/broadcast/model/protocol.ts +28 -0
  202. package/src/roborockCommunication/broadcast/model/requestMessage.ts +51 -0
  203. package/src/roborockCommunication/broadcast/model/responseMessage.ts +19 -0
  204. package/src/roborockCommunication/helper/chunkBuffer.ts +18 -0
  205. package/src/roborockCommunication/helper/cryptoHelper.ts +30 -0
  206. package/src/roborockCommunication/helper/messageDeserializer.ts +119 -0
  207. package/src/roborockCommunication/helper/messageSerializer.ts +101 -0
  208. package/src/roborockCommunication/helper/nameDecoder.ts +78 -0
  209. package/src/roborockCommunication/helper/sequence.ts +18 -0
  210. package/src/roborockCommunication/index.ts +25 -0
  211. package/src/roborockService.ts +657 -0
  212. package/src/runtimes/handleCloudMessage.ts +134 -0
  213. package/src/runtimes/handleHomeDataMessage.ts +67 -0
  214. package/src/runtimes/handleLocalMessage.ts +209 -0
  215. package/src/rvc.ts +97 -0
  216. package/src/settings.ts +1 -0
  217. package/src/share/function.ts +103 -0
  218. package/src/share/runtimeHelper.ts +23 -0
  219. package/src/tests/behaviors/roborock.vacuum/default/default.test.ts +134 -0
  220. package/src/tests/behaviors/roborock.vacuum/smart/runtimes.test.ts +64 -0
  221. package/src/tests/behaviors/roborock.vacuum/smart/smart.test.ts +215 -0
  222. package/src/tests/helper.test.ts +162 -0
  223. package/src/tests/initialData/getSupportedAreas.test.ts +181 -0
  224. package/src/tests/model/DockingStationStatus.test.ts +39 -0
  225. package/src/tests/platformRunner.test.ts +188 -0
  226. package/src/tests/platformRunner2.test.ts +228 -0
  227. package/src/tests/platformRunner3.test.ts +46 -0
  228. package/src/tests/roborockCommunication/RESTAPI/roborockAuthenticateApi.test.ts +144 -0
  229. package/src/tests/roborockCommunication/RESTAPI/roborockIoTApi.test.ts +106 -0
  230. package/src/tests/roborockCommunication/broadcast/client/LocalNetworkClient.test.ts +189 -0
  231. package/src/tests/roborockCommunication/broadcast/client/MQTTClient.test.ts +208 -0
  232. package/src/tests/roborockCommunication/broadcast/clientRouter.test.ts +168 -0
  233. package/src/tests/roborockCommunication/broadcast/listener/implementation/chainedConnectionListener.test.ts +59 -0
  234. package/src/tests/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.test.ts +46 -0
  235. package/src/tests/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.test.ts +71 -0
  236. package/src/tests/roborockCommunication/broadcast/listener/implementation/syncMessageListener.test.ts +86 -0
  237. package/src/tests/roborockCommunication/broadcast/messageProcessor.test.ts +126 -0
  238. package/src/tests/roborockService.setSelectedAreas.test.ts +61 -0
  239. package/src/tests/roborockService.test.ts +517 -0
  240. package/src/tests/roborockService2.test.ts +69 -0
  241. package/src/tests/roborockService3.test.ts +133 -0
  242. package/src/tests/roborockService4.test.ts +76 -0
  243. package/src/tests/roborockService5.test.ts +79 -0
  244. package/src/tests/runtimes/handleCloudMessage.test.ts +200 -0
  245. package/src/tests/runtimes/handleHomeDataMessage.test.ts +54 -0
  246. package/src/tests/runtimes/handleLocalMessage.test.ts +227 -0
  247. package/src/tests/testData/mockData.ts +370 -0
  248. package/src/tests/testData/mockHomeData-a187.json +286 -0
  249. package/tsconfig.jest.json +21 -0
  250. package/tsconfig.json +37 -0
  251. package/tsconfig.production.json +19 -0
  252. package/tslint.json +9 -0
  253. package/web-for-testing/README.md +47 -0
  254. package/web-for-testing/nodemon.json +7 -0
  255. package/web-for-testing/package-lock.json +6600 -0
  256. package/web-for-testing/package.json +36 -0
  257. package/web-for-testing/src/app.ts +194 -0
  258. package/web-for-testing/tsconfig-ext.json +19 -0
  259. package/web-for-testing/tsconfig.json +23 -0
  260. package/web-for-testing/views/index.ejs +172 -0
  261. package/web-for-testing/watch.mjs +93 -0
@@ -0,0 +1,359 @@
1
+ import { MapInfo } from '../../roborockCommunication/index.js';
2
+ export const supportedAreas = [
3
+ { areaId: 100, mapId: 0, areaInfo: { locationInfo: { locationName: 'Kitchen', floorNumber: 0, areaType: null }, landmarkInfo: null } },
4
+ { areaId: 101, mapId: 0, areaInfo: { locationInfo: { locationName: 'Study', floorNumber: 0, areaType: null }, landmarkInfo: null } },
5
+ { areaId: 102, mapId: 0, areaInfo: { locationInfo: { locationName: 'Living room', floorNumber: 0, areaType: null }, landmarkInfo: null } },
6
+ { areaId: 103, mapId: 0, areaInfo: { locationInfo: { locationName: 'Bedroom', floorNumber: 0, areaType: null }, landmarkInfo: null } },
7
+ { areaId: 104, mapId: 1, areaInfo: { locationInfo: { locationName: 'Living room', floorNumber: 1, areaType: null }, landmarkInfo: null } },
8
+ { areaId: 105, mapId: 1, areaInfo: { locationInfo: { locationName: 'Guest bedroom', floorNumber: 1, areaType: null }, landmarkInfo: null } },
9
+ { areaId: 106, mapId: 1, areaInfo: { locationInfo: { locationName: 'Master bedroom', floorNumber: 1, areaType: null }, landmarkInfo: null } },
10
+ { areaId: 107, mapId: 1, areaInfo: { locationInfo: { locationName: 'Balcony', floorNumber: 1, areaType: null }, landmarkInfo: null } },
11
+ ];
12
+ export const supportedMaps = [
13
+ { mapId: 0, name: 'First Map' },
14
+ { mapId: 1, name: 'Second Map' },
15
+ ];
16
+ export const roomIndexMap = {
17
+ indexMap: new Map([
18
+ [100, { roomId: 1, mapId: 0 }],
19
+ [101, { roomId: 2, mapId: 0 }],
20
+ [102, { roomId: 3, mapId: 0 }],
21
+ [103, { roomId: 4, mapId: 0 }],
22
+ [104, { roomId: 1, mapId: 1 }],
23
+ [105, { roomId: 2, mapId: 1 }],
24
+ [106, { roomId: 3, mapId: 1 }],
25
+ [107, { roomId: 4, mapId: 1 }],
26
+ ]),
27
+ roomMap: new Map([
28
+ [1, 104],
29
+ [2, 105],
30
+ [3, 106],
31
+ [4, 107],
32
+ ]),
33
+ };
34
+ export const mapInfo = new MapInfo({
35
+ max_multi_map: 1,
36
+ max_bak_map: 1,
37
+ multi_map_count: 1,
38
+ map_info: [
39
+ {
40
+ mapFlag: 0,
41
+ add_time: 1753511673,
42
+ length: 9,
43
+ name: 'First Map',
44
+ bak_maps: [{ mapFlag: 4, add_time: 1753578164 }],
45
+ rooms: [
46
+ { id: 1, tag: 14, iot_name_id: '11100845', iot_name: 'Kitchen' },
47
+ { id: 2, tag: 9, iot_name_id: '11100849', iot_name: 'Study' },
48
+ {
49
+ id: 3,
50
+ tag: 6,
51
+ iot_name_id: '11100842',
52
+ iot_name: 'Living room',
53
+ },
54
+ { id: 4, tag: 1, iot_name_id: '11100847', iot_name: 'Bedroom' },
55
+ ],
56
+ },
57
+ {
58
+ mapFlag: 1,
59
+ add_time: 1753579596,
60
+ length: 10,
61
+ name: 'Second Map',
62
+ bak_maps: [{ mapFlag: 5, add_time: 1753578579 }],
63
+ rooms: [
64
+ {
65
+ id: 1,
66
+ tag: 6,
67
+ iot_name_id: '11100842',
68
+ iot_name: 'Living room',
69
+ },
70
+ {
71
+ id: 2,
72
+ tag: 3,
73
+ iot_name_id: '12461114',
74
+ iot_name: 'Guest bedroom',
75
+ },
76
+ {
77
+ id: 3,
78
+ tag: 2,
79
+ iot_name_id: '12461109',
80
+ iot_name: 'Master bedroom',
81
+ },
82
+ { id: 4, tag: 7, iot_name_id: '12461111', iot_name: 'Balcony' },
83
+ ],
84
+ },
85
+ ],
86
+ });
87
+ export const roomData = [
88
+ [1, '11100845', 14],
89
+ [2, '11100849', 9],
90
+ [3, '11100842', 6],
91
+ [4, '11100847', 1],
92
+ ];
93
+ export const cloudMessageResult1 = {
94
+ msg_ver: 2,
95
+ msg_seq: 424,
96
+ state: 5,
97
+ battery: 100,
98
+ clean_time: 2823,
99
+ clean_area: 36002500,
100
+ error_code: 0,
101
+ map_present: 1,
102
+ in_cleaning: 0,
103
+ in_returning: 0,
104
+ in_fresh_state: 1,
105
+ lab_status: 3,
106
+ water_box_status: 1,
107
+ back_type: -1,
108
+ wash_phase: 0,
109
+ wash_ready: 1,
110
+ wash_status: 0,
111
+ fan_power: 110,
112
+ dnd_enabled: 0,
113
+ map_status: 3,
114
+ is_locating: 0,
115
+ lock_status: 0,
116
+ water_box_mode: 209,
117
+ distance_off: 155,
118
+ water_box_carriage_status: 1,
119
+ mop_forbidden_enable: 1,
120
+ camera_status: 1,
121
+ is_exploring: 0,
122
+ adbumper_status: [0, 0, 0],
123
+ water_shortage_status: 0,
124
+ dock_type: 14,
125
+ dust_collection_status: 0,
126
+ auto_dust_collection: 1,
127
+ avoid_count: 209,
128
+ mop_mode: 306,
129
+ debug_mode: 0,
130
+ in_warmup: 0,
131
+ collision_avoid_status: 1,
132
+ switch_map_mode: 1,
133
+ dock_error_status: 0,
134
+ charge_status: 1,
135
+ unsave_map_reason: 0,
136
+ unsave_map_flag: -1,
137
+ dry_status: 0,
138
+ rdt: 0,
139
+ clean_percent: 0,
140
+ extra_time: 860,
141
+ rss: 2,
142
+ dss: 168,
143
+ common_status: 2,
144
+ last_clean_t: 1754063701,
145
+ replenish_mode: 0,
146
+ repeat: 1,
147
+ kct: 0,
148
+ subdivision_sets: 0,
149
+ cleaning_info: { target_segment_id: -1, segment_id: 3, fan_power: 102, water_box_status: 202, mop_mode: 306 },
150
+ exit_dock: 0,
151
+ seq_type: 0,
152
+ };
153
+ export const cloudMessageResult2 = {
154
+ msg_ver: 2,
155
+ msg_seq: 424,
156
+ state: 5,
157
+ battery: 100,
158
+ clean_time: 2823,
159
+ clean_area: 36002500,
160
+ error_code: 0,
161
+ map_present: 1,
162
+ in_cleaning: 0,
163
+ in_returning: 0,
164
+ in_fresh_state: 1,
165
+ lab_status: 3,
166
+ water_box_status: 1,
167
+ back_type: -1,
168
+ wash_phase: 0,
169
+ wash_ready: 1,
170
+ wash_status: 0,
171
+ fan_power: 110,
172
+ dnd_enabled: 0,
173
+ map_status: 3,
174
+ is_locating: 0,
175
+ lock_status: 0,
176
+ water_box_mode: 209,
177
+ distance_off: 155,
178
+ water_box_carriage_status: 1,
179
+ mop_forbidden_enable: 1,
180
+ camera_status: 1,
181
+ is_exploring: 0,
182
+ adbumper_status: [0, 0, 0],
183
+ water_shortage_status: 0,
184
+ dock_type: 14,
185
+ dust_collection_status: 0,
186
+ auto_dust_collection: 1,
187
+ avoid_count: 209,
188
+ mop_mode: 306,
189
+ debug_mode: 0,
190
+ in_warmup: 0,
191
+ collision_avoid_status: 1,
192
+ switch_map_mode: 1,
193
+ dock_error_status: 0,
194
+ charge_status: 1,
195
+ unsave_map_reason: 0,
196
+ unsave_map_flag: -1,
197
+ dry_status: 0,
198
+ rdt: 0,
199
+ clean_percent: 0,
200
+ extra_time: 860,
201
+ rss: 2,
202
+ dss: 168,
203
+ common_status: 2,
204
+ last_clean_t: 1754063701,
205
+ replenish_mode: 0,
206
+ repeat: 1,
207
+ kct: 0,
208
+ subdivision_sets: 0,
209
+ cleaning_info: { target_segment_id: 4, segment_id: -1, fan_power: 102, water_box_status: 202, mop_mode: 306 },
210
+ exit_dock: 0,
211
+ seq_type: 0,
212
+ };
213
+ export const cloudMessageResult3 = {
214
+ msg_ver: 2,
215
+ msg_seq: 1579,
216
+ state: 5,
217
+ battery: 94,
218
+ clean_time: 567,
219
+ clean_area: 36002500,
220
+ error_code: 0,
221
+ map_present: 1,
222
+ in_cleaning: 0,
223
+ in_returning: 0,
224
+ in_fresh_state: 1,
225
+ lab_status: 3,
226
+ water_box_status: 1,
227
+ fan_power: 104,
228
+ dnd_enabled: 0,
229
+ map_status: 3,
230
+ is_locating: 0,
231
+ lock_status: 0,
232
+ water_box_mode: 202,
233
+ distance_off: 60,
234
+ water_box_carriage_status: 0,
235
+ mop_forbidden_enable: 0,
236
+ adbumper_status: [0, 0, 0],
237
+ dock_type: 5,
238
+ dust_collection_status: 0,
239
+ auto_dust_collection: 1,
240
+ debug_mode: 0,
241
+ switch_map_mode: 0,
242
+ dock_error_status: 0,
243
+ charge_status: 1,
244
+ };
245
+ export const homeData = {
246
+ id: 3645093,
247
+ name: 'My Home',
248
+ products: [
249
+ {
250
+ id: '2CjvhDFL7Q9NdJQmhE86zn',
251
+ name: 'Roborock Qrevo Edge Series',
252
+ model: 'test-model',
253
+ category: 'robot.vacuum.cleaner',
254
+ schema: [
255
+ { id: 101, name: 'rpc_request', code: 'rpc_request', mode: 'rw', type: 'RAW', property: null },
256
+ { id: 102, name: 'rpc_response', code: 'rpc_response', mode: 'rw', type: 'RAW', property: null },
257
+ { id: 120, name: '错误代码', code: 'error_code', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
258
+ { id: 121, name: '设备状态', code: 'state', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
259
+ { id: 122, name: '设备电量', code: 'battery', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
260
+ { id: 123, name: '清扫模式', code: 'fan_power', mode: 'rw', type: 'ENUM', property: '{"range": [""]}' },
261
+ { id: 124, name: '拖地模式', code: 'water_box_mode', mode: 'rw', type: 'ENUM', property: '{"range": [""]}' },
262
+ { id: 125, name: '主刷寿命', code: 'main_brush_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
263
+ { id: 126, name: '边刷寿命', code: 'side_brush_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
264
+ { id: 127, name: '滤网寿命', code: 'filter_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
265
+ { id: 128, name: '额外状态', code: 'additional_props', mode: 'ro', type: 'RAW', property: null },
266
+ { id: 130, name: '完成事件', code: 'task_complete', mode: 'ro', type: 'RAW', property: null },
267
+ { id: 131, name: '电量不足任务取消', code: 'task_cancel_low_power', mode: 'ro', type: 'RAW', property: null },
268
+ { id: 132, name: '运动中任务取消', code: 'task_cancel_in_motion', mode: 'ro', type: 'RAW', property: null },
269
+ { id: 133, name: '充电状态', code: 'charge_status', mode: 'ro', type: 'RAW', property: null },
270
+ { id: 134, name: '烘干状态', code: 'drying_status', mode: 'ro', type: 'RAW', property: null },
271
+ { id: 135, name: '离线原因细分', code: 'offline_status', mode: 'ro', type: 'RAW', property: null },
272
+ { id: 139, name: '回基站目的', code: 'back_type', mode: 'ro', type: 'RAW', property: null },
273
+ ],
274
+ },
275
+ ],
276
+ devices: [
277
+ {
278
+ duid: 'test-duid',
279
+ name: 'Roborock Qrevo Edge 5V1',
280
+ activeTime: 1749443275,
281
+ createTime: 1746940587,
282
+ localKey: 'v0OKpWXwBmiCk4ku',
283
+ productId: '2CjvhDFL7Q9NdJQmhE86zn',
284
+ online: true,
285
+ fv: '02.28.34',
286
+ pv: '1.0',
287
+ sn: 'RCIEBS50900224',
288
+ featureSet: '2247397454282751',
289
+ newFeatureSet: '00040040282834C9C2FA8F5C7EDEFFFE',
290
+ deviceStatus: { 120: 0, 121: 8, 122: 100, 123: 110, 124: 209, 125: 93, 126: 69, 127: 86, 128: 0, 133: 1, 134: 0, 135: 0, 139: 0 },
291
+ silentOtaSwitch: true,
292
+ rrHomeId: 3645093,
293
+ rooms: [
294
+ { id: 11100849, name: 'Study' },
295
+ { id: 11100847, name: 'Bedroom' },
296
+ { id: 11100845, name: 'Kitchen' },
297
+ { id: 11100842, name: 'Living room' },
298
+ ],
299
+ serialNumber: 'RCIEBS50900224',
300
+ data: {
301
+ id: 'test-duid',
302
+ firmwareVersion: '02.28.34',
303
+ serialNumber: 'RCIEBS50900224',
304
+ model: 'test-model',
305
+ category: 'robot.vacuum.cleaner',
306
+ batteryLevel: 100,
307
+ },
308
+ store: {
309
+ userData: {
310
+ uid: 3635748,
311
+ tokentype: '',
312
+ token: 'rr65af7107da5840:txP8ZF7dj8v7xUMkoFMzZA==:01981b12f83a7723a1cbef8c8e89a7e1',
313
+ rruid: 'rr65af7107da5840',
314
+ region: 'us',
315
+ countrycode: '84',
316
+ country: 'VN',
317
+ nickname: 'Ryan',
318
+ rriot: {
319
+ u: '6BtaRwE14spvanEazqX0kQ',
320
+ s: 'OsErWk',
321
+ h: '195Xn4u3fe',
322
+ k: 'ofKw7nJc',
323
+ r: { r: 'US', a: 'https://api-us.roborock.com', m: 'ssl://mqtt-us-2.roborock.com:8883', l: 'https://wood-us.roborock.com' },
324
+ },
325
+ },
326
+ localKey: 'v0OKpWXwBmiCk4ku',
327
+ pv: '1.0',
328
+ model: 'test-model',
329
+ },
330
+ schema: [
331
+ { id: 101, name: 'rpc_request', code: 'rpc_request', mode: 'rw', type: 'RAW', property: null },
332
+ { id: 102, name: 'rpc_response', code: 'rpc_response', mode: 'rw', type: 'RAW', property: null },
333
+ { id: 120, name: '错误代码', code: 'error_code', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
334
+ { id: 121, name: '设备状态', code: 'state', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
335
+ { id: 122, name: '设备电量', code: 'battery', mode: 'ro', type: 'ENUM', property: '{"range": [""]}' },
336
+ { id: 123, name: '清扫模式', code: 'fan_power', mode: 'rw', type: 'ENUM', property: '{"range": [""]}' },
337
+ { id: 124, name: '拖地模式', code: 'water_box_mode', mode: 'rw', type: 'ENUM', property: '{"range": [""]}' },
338
+ { id: 125, name: '主刷寿命', code: 'main_brush_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
339
+ { id: 126, name: '边刷寿命', code: 'side_brush_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
340
+ { id: 127, name: '滤网寿命', code: 'filter_life', mode: 'rw', type: 'VALUE', property: '{"max": 100, "min": 0, "step": 1, "unit": "null", "scale": 1}' },
341
+ { id: 128, name: '额外状态', code: 'additional_props', mode: 'ro', type: 'RAW', property: null },
342
+ { id: 130, name: '完成事件', code: 'task_complete', mode: 'ro', type: 'RAW', property: null },
343
+ { id: 131, name: '电量不足任务取消', code: 'task_cancel_low_power', mode: 'ro', type: 'RAW', property: null },
344
+ { id: 132, name: '运动中任务取消', code: 'task_cancel_in_motion', mode: 'ro', type: 'RAW', property: null },
345
+ { id: 133, name: '充电状态', code: 'charge_status', mode: 'ro', type: 'RAW', property: null },
346
+ { id: 134, name: '烘干状态', code: 'drying_status', mode: 'ro', type: 'RAW', property: null },
347
+ { id: 135, name: '离线原因细分', code: 'offline_status', mode: 'ro', type: 'RAW', property: null },
348
+ { id: 139, name: '回基站目的', code: 'back_type', mode: 'ro', type: 'RAW', property: null },
349
+ ],
350
+ },
351
+ ],
352
+ receivedDevices: [],
353
+ rooms: [
354
+ { id: 11100849, name: 'Study' },
355
+ { id: 11100847, name: 'Bedroom' },
356
+ { id: 11100845, name: 'Kitchen' },
357
+ { id: 11100842, name: 'Living room' },
358
+ ],
359
+ };
@@ -0,0 +1,80 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+ import eslintPluginJest from 'eslint-plugin-jest';
6
+ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
7
+ import eslintPluginN from 'eslint-plugin-n';
8
+
9
+ export default [
10
+ {
11
+ name: 'global ignores',
12
+ ignores: ['dist/', 'build/', 'node_modules/', 'coverage/', 'frontend/', 'rock-s0/', 'webui/', 'exampleData/', '.shouldnotcommit/', 'web-for-testing/'],
13
+ },
14
+ eslint.configs.recommended,
15
+ ...tseslint.configs.strict,
16
+ ...tseslint.configs.stylistic,
17
+ // ...tseslint.configs.strictTypeChecked,
18
+ // ...tseslint.configs.stylisticTypeChecked,
19
+ eslintPluginPrettier,
20
+ {
21
+ languageOptions: {
22
+ ecmaVersion: 'latest',
23
+ sourceType: 'module',
24
+ },
25
+ linterOptions: {
26
+ reportUnusedDisableDirectives: 'warn',
27
+ },
28
+ rules: {
29
+ 'no-console': 'warn',
30
+ 'no-undef': 'off',
31
+ 'spaced-comment': ['error', 'always'],
32
+ },
33
+ },
34
+ {
35
+ name: 'javascript',
36
+ files: ['**/*.js'],
37
+ ...tseslint.configs.disableTypeChecked,
38
+ },
39
+ {
40
+ name: 'typescript',
41
+ files: ['**/*.ts'],
42
+ ignores: ['**/__test__/*', '**/*.test.ts', '**/*.spec.ts'],
43
+ languageOptions: {
44
+ ecmaVersion: 'latest',
45
+ sourceType: 'module',
46
+ parser: tseslint.parser,
47
+ parserOptions: {
48
+ project: './tsconfig.json',
49
+ tsconfigRootDir: import.meta.dirname,
50
+ },
51
+ },
52
+ plugins: {
53
+ '@typescript-eslint': tseslint.plugin,
54
+ },
55
+ },
56
+ {
57
+ name: 'jest',
58
+ files: ['**/__test__/*', '**/*.test.ts', '**/*.spec.ts'],
59
+ plugins: {
60
+ '@typescript-eslint': tseslint.plugin,
61
+ jest: eslintPluginJest,
62
+ },
63
+ ...tseslint.configs.disableTypeChecked,
64
+ ...eslintPluginJest.configs['flat/recommended'],
65
+ rules: {
66
+ '@typescript-eslint/no-explicit-any': 'off',
67
+ '@typescript-eslint/no-non-null-assertion': 'off',
68
+ },
69
+ },
70
+ {
71
+ name: 'node',
72
+ files: ['**/*.ts'],
73
+ plugins: {
74
+ n: eslintPluginN,
75
+ },
76
+ rules: {
77
+ 'n/prefer-node-protocol': 'error',
78
+ },
79
+ },
80
+ ];
package/jest.config.js ADDED
@@ -0,0 +1,22 @@
1
+ export default {
2
+ preset: 'ts-jest/presets/default-esm',
3
+ testEnvironment: 'node',
4
+ extensionsToTreatAsEsm: ['.ts'],
5
+ moduleNameMapper: {
6
+ '^(\\.{1,2}/.*)\\.js$': '$1',
7
+ '^test-src/(.*)$': '<rootDir>/src/$1',
8
+ },
9
+ transform: {
10
+ '^.+\\.ts$': [
11
+ 'ts-jest',
12
+ {
13
+ useESM: true,
14
+ tsconfig: 'tsconfig.jest.json',
15
+ },
16
+ ],
17
+ },
18
+ transformIgnorePatterns: ['/node_modules/'],
19
+ testPathIgnorePatterns: ['/node_modules/', '/dist/', '/frontend/', 'webui', '.shouldnotcommit'],
20
+ coveragePathIgnorePatterns: ['/node_modules/', '/dist/', '/frontend/', '/src/mock/'],
21
+ setupFiles: ['./jest.setup.js'],
22
+ };
package/jest.setup.js ADDED
@@ -0,0 +1,2 @@
1
+ import { jest } from '@jest/globals';
2
+ global.jest = jest;
package/logo.png ADDED
Binary file
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "matterbridge-roborock-vacuum-plugin",
3
+ "type": "DynamicPlatform",
4
+ "version": "1.1.1-rc10",
5
+ "whiteList": [],
6
+ "blackList": [],
7
+ "useInterval": true,
8
+ "enableExperimental": {
9
+ "enableExperimentalFeature": false,
10
+ "advancedFeature": {
11
+ "showRoutinesAsRooms": false,
12
+ "includeDockStationStatus": false,
13
+ "forceRunAtDefault": false,
14
+ "useVacationModeToSendVacuumToDock": false,
15
+ "enableServerMode": false,
16
+ "alwaysExecuteAuthentication": false,
17
+ "enableMultipleMap": false
18
+ },
19
+ "cleanModeSettings": {
20
+ "enableCleanModeMapping": false,
21
+ "vacuuming": {
22
+ "fanMode": "Balanced",
23
+ "mopRouteMode": "Standard"
24
+ },
25
+ "mopping": {
26
+ "waterFlowMode": "Medium",
27
+ "mopRouteMode": "Standard",
28
+ "distanceOff": 25
29
+ },
30
+ "vacmop": {
31
+ "fanMode": "Balanced",
32
+ "waterFlowMode": "Medium",
33
+ "mopRouteMode": "Standard",
34
+ "distanceOff": 25
35
+ }
36
+ }
37
+ },
38
+ "authentication": {
39
+ "authenticationMethod": "VerificationCode",
40
+ "verificationCode": "",
41
+ "password": ""
42
+ },
43
+ "debug": true,
44
+ "unregisterOnShutdown": false,
45
+ "enableExperimentalFeature": false
46
+ }