matterbridge-roborock-vacuum-plugin 1.0.5
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/publish.yml +34 -0
- package/.tarignore +5 -0
- package/LICENSE +202 -0
- package/README.md +34 -0
- package/README_DEV.md +69 -0
- package/bmc-button.svg +22 -0
- package/dist/appliances.js +6 -0
- package/dist/behaviorFactory.js +18 -0
- package/dist/behaviors/BehaviorDeviceGeneric.js +31 -0
- package/dist/behaviors/roborock.vacuum/QREVO_EDGE_5V1/a187.js +94 -0
- package/dist/behaviors/roborock.vacuum/QREVO_EDGE_5V1/initalData.js +81 -0
- package/dist/behaviors/roborock.vacuum/QREVO_EDGE_5V1/runtimes.js +39 -0
- package/dist/behaviors/roborock.vacuum/default/default.js +58 -0
- package/dist/behaviors/roborock.vacuum/default/initalData.js +66 -0
- package/dist/clientManager.js +17 -0
- package/dist/extensions/AxiosStaticExtensions.js +22 -0
- package/dist/extensions/index.js +1 -0
- package/dist/helper.js +16 -0
- package/dist/index.js +4 -0
- package/dist/initialData/getBatteryStatus.js +24 -0
- package/dist/initialData/getOperationalStates.js +22 -0
- package/dist/initialData/getSupportedAreas.js +69 -0
- package/dist/initialData/getSupportedCleanModes.js +11 -0
- package/dist/initialData/getSupportedRunModes.js +18 -0
- package/dist/initialData/index.js +5 -0
- package/dist/model/CloudMessageModel.js +1 -0
- package/dist/model/DockingStationStatus.js +24 -0
- package/dist/model/RoomMap.js +18 -0
- package/dist/notifyMessageTypes.js +9 -0
- package/dist/platform.js +146 -0
- package/dist/platformRunner.js +249 -0
- package/dist/roborockCommunication/RESTAPI/roborockAuthenticateApi.js +73 -0
- package/dist/roborockCommunication/RESTAPI/roborockIoTApi.js +61 -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/authenticateResponse.js +1 -0
- package/dist/roborockCommunication/Zmodel/baseURL.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/messageResult.js +7 -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/userData.js +1 -0
- package/dist/roborockCommunication/Zmodel/vacuumError.js +27 -0
- package/dist/roborockCommunication/broadcast/abstractClient.js +41 -0
- package/dist/roborockCommunication/broadcast/client/LocalNetworkClient.js +148 -0
- package/dist/roborockCommunication/broadcast/client/MQTTClient.js +101 -0
- package/dist/roborockCommunication/broadcast/client.js +1 -0
- package/dist/roborockCommunication/broadcast/clientRouter.js +79 -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 +21 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.js +11 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.js +27 -0
- package/dist/roborockCommunication/broadcast/listener/implementation/syncMessageListener.js +35 -0
- package/dist/roborockCommunication/broadcast/listener/index.js +1 -0
- package/dist/roborockCommunication/broadcast/messageProcessor.js +79 -0
- package/dist/roborockCommunication/broadcast/model/dps.js +1 -0
- package/dist/roborockCommunication/broadcast/model/messageContext.js +26 -0
- package/dist/roborockCommunication/broadcast/model/protocol.js +19 -0
- package/dist/roborockCommunication/broadcast/model/requestMessage.js +33 -0
- package/dist/roborockCommunication/broadcast/model/responseMessage.js +14 -0
- package/dist/roborockCommunication/helper/chunkBuffer.js +17 -0
- package/dist/roborockCommunication/helper/cryptoHelper.js +27 -0
- package/dist/roborockCommunication/helper/messageDeserializer.js +74 -0
- package/dist/roborockCommunication/helper/messageSerializer.js +70 -0
- package/dist/roborockCommunication/helper/nameDecoder.js +66 -0
- package/dist/roborockCommunication/helper/sequence.js +16 -0
- package/dist/roborockCommunication/index.js +9 -0
- package/dist/roborockService.js +300 -0
- package/dist/rvc.js +39 -0
- package/dist/settings.js +1 -0
- package/dist/share/function.js +96 -0
- package/dist/share/runtimeHelper.js +29 -0
- package/eslint.config.js +76 -0
- package/matterbridge-roborock-vacuum-plugin.config.json +11 -0
- package/matterbridge-roborock-vacuum-plugin.schema.json +57 -0
- package/package.json +43 -0
- package/prettier.config.js +49 -0
- package/src/appliances.ts +15 -0
- package/src/behaviorFactory.ts +24 -0
- package/src/behaviors/BehaviorDeviceGeneric.ts +39 -0
- package/src/behaviors/roborock.vacuum/QREVO_EDGE_5V1/a187.ts +117 -0
- package/src/behaviors/roborock.vacuum/QREVO_EDGE_5V1/initalData.ts +85 -0
- package/src/behaviors/roborock.vacuum/QREVO_EDGE_5V1/runtimes.ts +29 -0
- package/src/behaviors/roborock.vacuum/default/default.ts +78 -0
- package/src/behaviors/roborock.vacuum/default/initalData.ts +69 -0
- package/src/clientManager.ts +23 -0
- package/src/extensions/AxiosStaticExtensions.ts +35 -0
- package/src/extensions/index.ts +1 -0
- package/src/helper.ts +22 -0
- package/src/index.ts +16 -0
- package/src/initialData/getBatteryStatus.ts +26 -0
- package/src/initialData/getOperationalStates.ts +24 -0
- package/src/initialData/getSupportedAreas.ts +95 -0
- package/src/initialData/getSupportedCleanModes.ts +13 -0
- package/src/initialData/getSupportedRunModes.ts +21 -0
- package/src/initialData/index.ts +5 -0
- package/src/model/CloudMessageModel.ts +13 -0
- package/src/model/DockingStationStatus.ts +37 -0
- package/src/model/RoomMap.ts +44 -0
- package/src/notifyMessageTypes.ts +8 -0
- package/src/platform.ts +192 -0
- package/src/platformRunner.ts +292 -0
- package/src/roborockCommunication/RESTAPI/roborockAuthenticateApi.ts +98 -0
- package/src/roborockCommunication/RESTAPI/roborockIoTApi.ts +70 -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/authenticateResponse.ts +5 -0
- package/src/roborockCommunication/Zmodel/baseURL.ts +5 -0
- package/src/roborockCommunication/Zmodel/device.ts +39 -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/messageResult.ts +72 -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 +25 -0
- package/src/roborockCommunication/Zmodel/userData.ts +23 -0
- package/src/roborockCommunication/Zmodel/vacuumError.ts +35 -0
- package/src/roborockCommunication/broadcast/abstractClient.ts +61 -0
- package/src/roborockCommunication/broadcast/client/LocalNetworkClient.ts +177 -0
- package/src/roborockCommunication/broadcast/client/MQTTClient.ts +129 -0
- package/src/roborockCommunication/broadcast/client.ts +19 -0
- package/src/roborockCommunication/broadcast/clientRouter.ts +100 -0
- package/src/roborockCommunication/broadcast/listener/abstractConnectionListener.ts +5 -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 +26 -0
- package/src/roborockCommunication/broadcast/listener/implementation/chainedMessageListener.ts +16 -0
- package/src/roborockCommunication/broadcast/listener/implementation/simpleMessageListener.ts +37 -0
- package/src/roborockCommunication/broadcast/listener/implementation/syncMessageListener.ts +48 -0
- package/src/roborockCommunication/broadcast/listener/index.ts +3 -0
- package/src/roborockCommunication/broadcast/messageProcessor.ts +110 -0
- package/src/roborockCommunication/broadcast/model/dps.ts +17 -0
- package/src/roborockCommunication/broadcast/model/messageContext.ts +34 -0
- package/src/roborockCommunication/broadcast/model/protocol.ts +19 -0
- package/src/roborockCommunication/broadcast/model/requestMessage.ts +44 -0
- package/src/roborockCommunication/broadcast/model/responseMessage.ts +19 -0
- package/src/roborockCommunication/helper/chunkBuffer.ts +18 -0
- package/src/roborockCommunication/helper/cryptoHelper.ts +34 -0
- package/src/roborockCommunication/helper/messageDeserializer.ts +99 -0
- package/src/roborockCommunication/helper/messageSerializer.ts +82 -0
- package/src/roborockCommunication/helper/nameDecoder.ts +78 -0
- package/src/roborockCommunication/helper/sequence.ts +18 -0
- package/src/roborockCommunication/index.ts +15 -0
- package/src/roborockService.ts +379 -0
- package/src/rvc.ts +66 -0
- package/src/settings.ts +1 -0
- package/src/share/function.ts +106 -0
- package/src/share/runtimeHelper.ts +35 -0
- package/tsconfig.json +37 -0
- package/tsconfig.production.json +19 -0
- package/tslint.json +9 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { RvcCleanMode, RvcOperationalState, RvcRunMode } from 'matterbridge/matter/clusters';
|
|
2
|
+
export function getSupportedRunModesA187() {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
label: 'Idle',
|
|
6
|
+
mode: 1,
|
|
7
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Idle }],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'Cleaning',
|
|
11
|
+
mode: 2,
|
|
12
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Mapping',
|
|
16
|
+
mode: 3,
|
|
17
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Mapping }],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
export function getSupportedCleanModesA187() {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
label: 'Smart Plan',
|
|
25
|
+
mode: 4,
|
|
26
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Mop }, { value: RvcCleanMode.ModeTag.Vacuum }, { value: RvcCleanMode.ModeTag.Auto }],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Mop',
|
|
30
|
+
mode: 5,
|
|
31
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Mop }, { value: RvcCleanMode.ModeTag.Auto }],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Vacuum',
|
|
35
|
+
mode: 6,
|
|
36
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Vacuum }, { value: RvcCleanMode.ModeTag.Auto }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Mop & Vacuum',
|
|
40
|
+
mode: 7,
|
|
41
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Mop }, { value: RvcCleanMode.ModeTag.Vacuum }, { value: RvcCleanMode.ModeTag.DeepClean }],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Custom',
|
|
45
|
+
mode: 8,
|
|
46
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Mop }, { value: RvcCleanMode.ModeTag.Vacuum }, { value: RvcCleanMode.ModeTag.Quick }],
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
export function getOperationalStatesA187() {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
operationalStateId: RvcOperationalState.OperationalState.Stopped,
|
|
54
|
+
operationalStateLabel: 'Stopped',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
operationalStateId: RvcOperationalState.OperationalState.Running,
|
|
58
|
+
operationalStateLabel: 'Running',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
operationalStateId: RvcOperationalState.OperationalState.Paused,
|
|
62
|
+
operationalStateLabel: 'Paused',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
operationalStateId: RvcOperationalState.OperationalState.Error,
|
|
66
|
+
operationalStateLabel: 'Error',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
operationalStateId: RvcOperationalState.OperationalState.SeekingCharger,
|
|
70
|
+
operationalStateLabel: 'SeekingCharger',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
operationalStateId: RvcOperationalState.OperationalState.Charging,
|
|
74
|
+
operationalStateLabel: 'Charging',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
operationalStateId: RvcOperationalState.OperationalState.Docked,
|
|
78
|
+
operationalStateLabel: 'Docked',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MopWaterFlowA187, VacuumSuctionPowerA187 } from './a187.js';
|
|
2
|
+
export function getCurrentCleanModeA187(fan_power, water_box_mode) {
|
|
3
|
+
if (!fan_power || !water_box_mode)
|
|
4
|
+
return undefined;
|
|
5
|
+
if (fan_power == VacuumSuctionPowerA187.Smart || water_box_mode == MopWaterFlowA187.Smart)
|
|
6
|
+
return 4;
|
|
7
|
+
if (fan_power == VacuumSuctionPowerA187.Custom || water_box_mode == MopWaterFlowA187.Custom)
|
|
8
|
+
return 8;
|
|
9
|
+
if (fan_power == VacuumSuctionPowerA187.Off)
|
|
10
|
+
return 5;
|
|
11
|
+
if (water_box_mode == MopWaterFlowA187.Off)
|
|
12
|
+
return 6;
|
|
13
|
+
else
|
|
14
|
+
return 7;
|
|
15
|
+
}
|
|
16
|
+
export function getCurrentCleanModeFromFanPowerA187(fan_power) {
|
|
17
|
+
if (!fan_power)
|
|
18
|
+
return undefined;
|
|
19
|
+
if (fan_power == VacuumSuctionPowerA187.Smart)
|
|
20
|
+
return 4;
|
|
21
|
+
if (fan_power == VacuumSuctionPowerA187.Custom)
|
|
22
|
+
return 8;
|
|
23
|
+
if (fan_power == VacuumSuctionPowerA187.Off)
|
|
24
|
+
return 5;
|
|
25
|
+
else
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
export function getCurrentCleanModeFromWaterBoxModeA187(water_box_mode) {
|
|
29
|
+
if (!water_box_mode)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (water_box_mode == MopWaterFlowA187.Smart)
|
|
32
|
+
return 4;
|
|
33
|
+
if (water_box_mode == MopWaterFlowA187.Custom)
|
|
34
|
+
return 8;
|
|
35
|
+
if (water_box_mode == MopWaterFlowA187.Off)
|
|
36
|
+
return 6;
|
|
37
|
+
else
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BehaviorRoborock } from '../../BehaviorDeviceGeneric.js';
|
|
2
|
+
export class DefaultBehavior extends BehaviorRoborock {
|
|
3
|
+
}
|
|
4
|
+
export var DefaultBehaviorRoborock;
|
|
5
|
+
(function (DefaultBehaviorRoborock) {
|
|
6
|
+
class State {
|
|
7
|
+
device;
|
|
8
|
+
}
|
|
9
|
+
DefaultBehaviorRoborock.State = State;
|
|
10
|
+
})(DefaultBehaviorRoborock || (DefaultBehaviorRoborock = {}));
|
|
11
|
+
const RvcRunMode = {
|
|
12
|
+
[1]: 'Idle',
|
|
13
|
+
[2]: 'Cleaning',
|
|
14
|
+
[3]: 'Mapping',
|
|
15
|
+
};
|
|
16
|
+
const RvcCleanMode = {
|
|
17
|
+
[4]: 'Mop',
|
|
18
|
+
[5]: 'Vacuum',
|
|
19
|
+
};
|
|
20
|
+
export function setDefaultCommandHandler(duid, handler, logger, roborockService) {
|
|
21
|
+
handler.setCommandHandler('changeToMode', async (newMode) => {
|
|
22
|
+
const activity = RvcRunMode[newMode] || RvcCleanMode[newMode];
|
|
23
|
+
switch (activity) {
|
|
24
|
+
case 'Cleaning': {
|
|
25
|
+
await roborockService.startClean(duid);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
case 'Mop':
|
|
29
|
+
case 'Vacuum': {
|
|
30
|
+
logger.notice('DefaultBehavior-ChangeCleanMode to: ', activity);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
logger.notice('DefaultBehavior-changeToMode-Unknown: ', newMode);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
handler.setCommandHandler('selectAreas', async (newAreas) => {
|
|
39
|
+
logger.notice(`DefaultBehavior-selectAreas: ${newAreas}`);
|
|
40
|
+
roborockService.setSelectedAreas(duid, newAreas ?? []);
|
|
41
|
+
});
|
|
42
|
+
handler.setCommandHandler('pause', async () => {
|
|
43
|
+
logger.notice('DefaultBehavior-Pause');
|
|
44
|
+
await roborockService.pauseClean(duid);
|
|
45
|
+
});
|
|
46
|
+
handler.setCommandHandler('resume', async () => {
|
|
47
|
+
logger.notice('DefaultBehavior-Resume');
|
|
48
|
+
await roborockService.resumeClean(duid);
|
|
49
|
+
});
|
|
50
|
+
handler.setCommandHandler('goHome', async () => {
|
|
51
|
+
logger.notice('DefaultBehavior-GoHome');
|
|
52
|
+
await roborockService.stopAndGoHome(duid);
|
|
53
|
+
});
|
|
54
|
+
handler.setCommandHandler('PlaySoundToLocate', async (identifyTime) => {
|
|
55
|
+
logger.notice('DefaultBehavior-PlaySoundToLocate');
|
|
56
|
+
await roborockService.playSoundToLocate(duid);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { RvcCleanMode, RvcOperationalState, RvcRunMode } from 'matterbridge/matter/clusters';
|
|
2
|
+
export function getDefaultSupportedRunModes() {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
label: 'Idle',
|
|
6
|
+
mode: 1,
|
|
7
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Idle }],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'Cleaning',
|
|
11
|
+
mode: 2,
|
|
12
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Mapping',
|
|
16
|
+
mode: 3,
|
|
17
|
+
modeTags: [{ value: RvcRunMode.ModeTag.Mapping }],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
export function getDefaultSupportedCleanModes() {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
label: 'Vacuum',
|
|
25
|
+
mode: 4,
|
|
26
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Vacuum }],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Mop',
|
|
30
|
+
mode: 5,
|
|
31
|
+
modeTags: [{ value: RvcCleanMode.ModeTag.Mop }],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
export function getDefaultOperationalStates() {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
operationalStateId: RvcOperationalState.OperationalState.Stopped,
|
|
39
|
+
operationalStateLabel: 'Stopped',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
operationalStateId: RvcOperationalState.OperationalState.Running,
|
|
43
|
+
operationalStateLabel: 'Running',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
operationalStateId: RvcOperationalState.OperationalState.Paused,
|
|
47
|
+
operationalStateLabel: 'Paused',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
operationalStateId: RvcOperationalState.OperationalState.Error,
|
|
51
|
+
operationalStateLabel: 'Error',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
operationalStateId: RvcOperationalState.OperationalState.SeekingCharger,
|
|
55
|
+
operationalStateLabel: 'SeekingCharger',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
operationalStateId: RvcOperationalState.OperationalState.Charging,
|
|
59
|
+
operationalStateLabel: 'Charging',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
operationalStateId: RvcOperationalState.OperationalState.Docked,
|
|
63
|
+
operationalStateLabel: 'Docked',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClientRouter } from './roborockCommunication/broadcast/clientRouter.js';
|
|
2
|
+
export default class ClientManager {
|
|
3
|
+
clients = new Map();
|
|
4
|
+
logger;
|
|
5
|
+
constructor(logger) {
|
|
6
|
+
this.logger = logger;
|
|
7
|
+
}
|
|
8
|
+
get(username, userdata) {
|
|
9
|
+
if (!this.clients.has(username)) {
|
|
10
|
+
this.clients.set(username, new ClientRouter(this.logger, userdata));
|
|
11
|
+
}
|
|
12
|
+
return this.clients.get(username);
|
|
13
|
+
}
|
|
14
|
+
destroy(username) {
|
|
15
|
+
this.clients.delete(username);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
axios.interceptRequestAndResponse = function (logger) {
|
|
3
|
+
this.interceptors.request.use((request) => {
|
|
4
|
+
logger.debug('Axios Request:', {
|
|
5
|
+
method: request.method,
|
|
6
|
+
url: request.url,
|
|
7
|
+
data: request.data,
|
|
8
|
+
headers: request.headers,
|
|
9
|
+
});
|
|
10
|
+
return request;
|
|
11
|
+
});
|
|
12
|
+
this.interceptors.response.use((response) => {
|
|
13
|
+
logger.debug('Axios Response:', {
|
|
14
|
+
status: response.status,
|
|
15
|
+
data: response.data,
|
|
16
|
+
headers: response.headers,
|
|
17
|
+
url: response.config.url,
|
|
18
|
+
});
|
|
19
|
+
return response;
|
|
20
|
+
});
|
|
21
|
+
return this;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './AxiosStaticExtensions.js';
|
package/dist/helper.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getVacuumProperty(device, property) {
|
|
2
|
+
if (device) {
|
|
3
|
+
const schemas = device.schema;
|
|
4
|
+
const schema = schemas.find((sch) => sch.code == property);
|
|
5
|
+
if (schema && device.deviceStatus && device.deviceStatus[schema.id] != undefined) {
|
|
6
|
+
return Number(device.deviceStatus[schema.id]);
|
|
7
|
+
}
|
|
8
|
+
if (device.deviceStatus && device.deviceStatus[property] != undefined) {
|
|
9
|
+
return Number(device.deviceStatus[property]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
export function isSupportedDevice(model) {
|
|
15
|
+
return model.startsWith('roborock.vacuum.');
|
|
16
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PowerSource } from 'matterbridge/matter/clusters';
|
|
2
|
+
import { OperationStatusCode } from '../roborockCommunication/Zenum/operationStatusCode.js';
|
|
3
|
+
export function getBatteryStatus(batteryLevel) {
|
|
4
|
+
if (batteryLevel === undefined)
|
|
5
|
+
return PowerSource.BatChargeLevel.Ok;
|
|
6
|
+
if (batteryLevel >= 70) {
|
|
7
|
+
return PowerSource.BatChargeLevel.Ok;
|
|
8
|
+
}
|
|
9
|
+
else if (batteryLevel >= 40) {
|
|
10
|
+
return PowerSource.BatChargeLevel.Warning;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return PowerSource.BatChargeLevel.Critical;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function getBatteryState(deviceState, batRemaining) {
|
|
17
|
+
if (deviceState == OperationStatusCode.Charging) {
|
|
18
|
+
return batRemaining < 100 ? PowerSource.BatChargeState.IsCharging : PowerSource.BatChargeState.IsAtFullCharge;
|
|
19
|
+
}
|
|
20
|
+
if (deviceState == OperationStatusCode.ChargingError) {
|
|
21
|
+
return PowerSource.BatChargeState.IsNotCharging;
|
|
22
|
+
}
|
|
23
|
+
return PowerSource.BatChargeState.IsAtFullCharge;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RvcOperationalState } from 'matterbridge/matter/clusters';
|
|
2
|
+
import { getOperationalStatesA187 } from '../behaviors/roborock.vacuum/QREVO_EDGE_5V1/initalData.js';
|
|
3
|
+
import { getDefaultOperationalStates } from '../behaviors/roborock.vacuum/default/initalData.js';
|
|
4
|
+
import { DeviceModel } from '../roborockCommunication/Zmodel/deviceModel.js';
|
|
5
|
+
import { VacuumErrorCode } from '../roborockCommunication/Zenum/vacuumAndDockErrorCode.js';
|
|
6
|
+
export function getOperationalStates(model) {
|
|
7
|
+
switch (model) {
|
|
8
|
+
case DeviceModel.QREVO_EDGE_5V1:
|
|
9
|
+
return getOperationalStatesA187();
|
|
10
|
+
default:
|
|
11
|
+
return getDefaultOperationalStates();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function getOperationalErrorState(errorCode) {
|
|
15
|
+
switch (errorCode) {
|
|
16
|
+
case VacuumErrorCode.None:
|
|
17
|
+
return undefined;
|
|
18
|
+
default: {
|
|
19
|
+
return RvcOperationalState.OperationalState.Error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export function getSupportedAreas(rooms, roomMap, log) {
|
|
2
|
+
log?.debug('getSupportedAreas', JSON.stringify(rooms));
|
|
3
|
+
log?.debug('getSupportedAreas', JSON.stringify(roomMap));
|
|
4
|
+
if (!rooms || rooms.length === 0 || !roomMap?.rooms || roomMap.rooms.length == 0) {
|
|
5
|
+
log?.error('No rooms found');
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
areaId: 1,
|
|
9
|
+
mapId: null,
|
|
10
|
+
areaInfo: {
|
|
11
|
+
locationInfo: {
|
|
12
|
+
locationName: 'Unknown',
|
|
13
|
+
floorNumber: null,
|
|
14
|
+
areaType: null,
|
|
15
|
+
},
|
|
16
|
+
landmarkInfo: null,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
const supportedAreas = rooms.map((room, index) => {
|
|
22
|
+
return {
|
|
23
|
+
areaId: roomMap.getRoomId(room.id) ?? index + 1,
|
|
24
|
+
mapId: null,
|
|
25
|
+
areaInfo: {
|
|
26
|
+
locationInfo: {
|
|
27
|
+
locationName: room.name,
|
|
28
|
+
floorNumber: null,
|
|
29
|
+
areaType: null,
|
|
30
|
+
},
|
|
31
|
+
landmarkInfo: null,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const duplicated = findDuplicatedAreaIds(supportedAreas, log);
|
|
36
|
+
return duplicated
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
areaId: 1,
|
|
40
|
+
mapId: null,
|
|
41
|
+
areaInfo: {
|
|
42
|
+
locationInfo: {
|
|
43
|
+
locationName: 'Unknown',
|
|
44
|
+
floorNumber: null,
|
|
45
|
+
areaType: null,
|
|
46
|
+
},
|
|
47
|
+
landmarkInfo: null,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: supportedAreas;
|
|
52
|
+
}
|
|
53
|
+
function findDuplicatedAreaIds(areas, log) {
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const duplicates = [];
|
|
56
|
+
for (const area of areas) {
|
|
57
|
+
if (seen.has(area.areaId)) {
|
|
58
|
+
duplicates.push(area.areaId);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
seen.add(area.areaId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (duplicates.length > 0 && log) {
|
|
65
|
+
const duplicated = areas.filter((x) => duplicates.includes(x.areaId));
|
|
66
|
+
log.error(`Duplicated areaId(s) found: ${JSON.stringify(duplicated)}`);
|
|
67
|
+
}
|
|
68
|
+
return duplicates.length > 0;
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getSupportedCleanModesA187 } from '../behaviors/roborock.vacuum/QREVO_EDGE_5V1/initalData.js';
|
|
2
|
+
import { getDefaultSupportedCleanModes } from '../behaviors/roborock.vacuum/default/initalData.js';
|
|
3
|
+
import { DeviceModel } from '../roborockCommunication/Zmodel/deviceModel.js';
|
|
4
|
+
export function getSupportedCleanModes(model) {
|
|
5
|
+
switch (model) {
|
|
6
|
+
case DeviceModel.QREVO_EDGE_5V1:
|
|
7
|
+
return getSupportedCleanModesA187();
|
|
8
|
+
default:
|
|
9
|
+
return getDefaultSupportedCleanModes();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getSupportedRunModesA187 } from '../behaviors/roborock.vacuum/QREVO_EDGE_5V1/initalData.js';
|
|
2
|
+
import { getDefaultSupportedRunModes } from '../behaviors/roborock.vacuum/default/initalData.js';
|
|
3
|
+
import { DeviceModel } from '../roborockCommunication/Zmodel/deviceModel.js';
|
|
4
|
+
export function getRunningMode(model, modeTag) {
|
|
5
|
+
if (!model || !modeTag)
|
|
6
|
+
return null;
|
|
7
|
+
const supportedMode = getSupportedRunModes(model);
|
|
8
|
+
const runningMode = supportedMode.find((s) => s.modeTags.some((mt) => mt.value === modeTag));
|
|
9
|
+
return runningMode?.mode ?? null;
|
|
10
|
+
}
|
|
11
|
+
export function getSupportedRunModes(model) {
|
|
12
|
+
switch (model) {
|
|
13
|
+
case DeviceModel.QREVO_EDGE_5V1:
|
|
14
|
+
return getSupportedRunModesA187();
|
|
15
|
+
default:
|
|
16
|
+
return getDefaultSupportedRunModes();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getSupportedRunModes } from './getSupportedRunModes.js';
|
|
2
|
+
export { getOperationalStates, getOperationalErrorState } from './getOperationalStates.js';
|
|
3
|
+
export { getSupportedCleanModes } from './getSupportedCleanModes.js';
|
|
4
|
+
export { getSupportedAreas } from './getSupportedAreas.js';
|
|
5
|
+
export { getBatteryStatus, getBatteryState } from './getBatteryStatus.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var DockingStationStatusType;
|
|
2
|
+
(function (DockingStationStatusType) {
|
|
3
|
+
DockingStationStatusType[DockingStationStatusType["Unknown"] = 0] = "Unknown";
|
|
4
|
+
DockingStationStatusType[DockingStationStatusType["Error"] = 1] = "Error";
|
|
5
|
+
DockingStationStatusType[DockingStationStatusType["OK"] = 2] = "OK";
|
|
6
|
+
})(DockingStationStatusType || (DockingStationStatusType = {}));
|
|
7
|
+
export function parseDockingStationStatus(dss) {
|
|
8
|
+
return {
|
|
9
|
+
cleanFluidStatus: (dss >> 10) & 0b11,
|
|
10
|
+
waterBoxFilterStatus: (dss >> 8) & 0b11,
|
|
11
|
+
dustBagStatus: (dss >> 6) & 0b11,
|
|
12
|
+
dirtyWaterBoxStatus: (dss >> 4) & 0b11,
|
|
13
|
+
clearWaterBoxStatus: (dss >> 2) & 0b11,
|
|
14
|
+
isUpdownWaterReady: dss & 0b11,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function hasDockingStationError(status) {
|
|
18
|
+
return (status.cleanFluidStatus === DockingStationStatusType.Error ||
|
|
19
|
+
status.waterBoxFilterStatus === DockingStationStatusType.Error ||
|
|
20
|
+
status.dustBagStatus === DockingStationStatusType.Error ||
|
|
21
|
+
status.dirtyWaterBoxStatus === DockingStationStatusType.Error ||
|
|
22
|
+
status.clearWaterBoxStatus === DockingStationStatusType.Error ||
|
|
23
|
+
status.isUpdownWaterReady === DockingStationStatusType.Error);
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default class RoomMap {
|
|
2
|
+
rooms = [];
|
|
3
|
+
constructor(roomData, rooms) {
|
|
4
|
+
this.rooms = roomData.map((entry) => {
|
|
5
|
+
return {
|
|
6
|
+
id: entry[0],
|
|
7
|
+
globalId: Number(entry[1]),
|
|
8
|
+
displayName: rooms.find((r) => Number(r.id) == Number(entry[1]))?.name,
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
getGlobalId(id) {
|
|
13
|
+
return this.rooms.find((r) => Number(r.id) == Number(id))?.globalId;
|
|
14
|
+
}
|
|
15
|
+
getRoomId(globalId) {
|
|
16
|
+
return this.rooms.find((r) => Number(r.globalId) == Number(globalId))?.id;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var NotifyMessageTypes;
|
|
2
|
+
(function (NotifyMessageTypes) {
|
|
3
|
+
NotifyMessageTypes["LocalMessage"] = "LocalMessage";
|
|
4
|
+
NotifyMessageTypes["CloudMessage"] = "CloudMessage";
|
|
5
|
+
NotifyMessageTypes["BatteryUpdate"] = "BatteryUpdate";
|
|
6
|
+
NotifyMessageTypes["ErrorOccurred"] = "ErrorOccurred";
|
|
7
|
+
NotifyMessageTypes["HomeData"] = "HomeData";
|
|
8
|
+
NotifyMessageTypes["DeviceStatus"] = "DeviceStatus";
|
|
9
|
+
})(NotifyMessageTypes || (NotifyMessageTypes = {}));
|