Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mop pad status and some states for Dreame/Xiaomi #1023

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions lib/dreame.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ const DreameState = {
SWEEPING_AND_MOPPING: 12,
CHARGING_COMPLETED: 13,
UPGRADING: 14,
WATER_INSPECTING: 19,
WASHING_MOP_PAUSE: 21,
DUST_COLLECTION: 22,
REMOTE_CLEAN: 23
};

const DreameWashBaseState = {
Expand All @@ -138,15 +142,23 @@ const DreameProperties = {
control_mapping: {
0: DreameState.UNKNOWN,
3: DreameState.IDLE,
5: [DreameState.SWEEPING_AND_MOPPING, DreameState.SWEEPING],
5: DreameState.SWEEPING,
6: DreameState.RETURNING,
8: [DreameState.CHARGING, DreameState.CHARGING_COMPLETED],
8: DreameState.CHARGING,
10: DreameState.PAUSED,
12: DreameState.ERROR,
14: DreameState.UPGRADING,
22: DreameState.DUST_COLLECTION,
26: DreameState.RETURNING_WASHING,
27: DreameState.WASHING_MOP_PAUSE,
28: DreameState.DRYING,
29: DreameState.WASHING,
30: DreameState.MOPPING,
31: DreameState.SWEEPING_AND_MOPPING,
32: DreameState.REMOTE_CLEAN,
33: DreameState.WATER_INSPECTING,
34: DreameState.CHARGING_COMPLETED,
35: DreameState.BUILDING,
},
type: 'int',
},
Expand Down Expand Up @@ -350,7 +362,7 @@ const DreameProperties = {
AUTO_EMPTY_STATUS: { did: '', siid: 15, piid: 5 },
SENSOR_DIRTY_LEFT: { did: '', siid: 16, piid: 1, control: 'consumable.sensors', type: 'int' },
SENSOR_DIRTY_TIME_LEFT: { did: '', siid: 16, piid: 2 },
MOP_PAD_LEFT: { did: '', siid: 18, piid: 1 },
MOP_PAD_LEFT: { did: '', siid: 18, piid: 1, control: 'consumable.mop_pad', type: 'int' },
MOP_PAD_TIME_LEFT: { did: '', siid: 18, piid: 2 },
SILVER_ION_TIME_LEFT: { did: '', siid: 19, piid: 1 },
SILVER_ION_LEFT: { did: '', siid: 19, piid: 2 },
Expand Down Expand Up @@ -397,7 +409,7 @@ const DreameActions = {
RESET_FILTER: { did: '', siid: 11, aiid: 1, control: 'consumable.filter_reset' },
RESET_SENSOR: { did: '', siid: 16, aiid: 1, control: 'consumable.sensors_reset' },
START_AUTO_EMPTY: { did: '', siid: 15, aiid: 1 },
RESET_MOP_PAD: { did: '', siid: 18, aiid: 1 },
RESET_MOP_PAD: { did: '', siid: 18, aiid: 1, control: 'consumable.mop_pad_reset' },
RESET_SILVER_ION: { did: '', siid: 19, aiid: 1 },
RESET_DETERGENT: { did: '', siid: 20, aiid: 1 },
STREAM_CAMERA: { did: '', siid: 10001, aiid: 1 },
Expand Down Expand Up @@ -449,6 +461,7 @@ class DreameManager {
DreameProperties.CLEANING_TIME,
DreameProperties.VOLUME,
DreameProperties.MAIN_BRUSH_LEFT,
DreameProperties.MOP_PAD_LEFT,
DreameProperties.SIDE_BRUSH_LEFT,
DreameProperties.FILTER_LEFT,
DreameProperties.SENSOR_DIRTY_LEFT,
Expand Down
39 changes: 37 additions & 2 deletions lib/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,35 @@ module.exports = {
},
calc: 3600 * 3, // 300h
},
mop_pad: {
state: {
_id: 'mop_pad',
type: 'state',
common: {
name: 'Mop pad lifetime',
type: 'number',
role: 'value.usage.mop',
read: true,
write: false,
unit: '%',
},
native: {},
},
button: {
_id: 'mop_pad_reset',
type: 'state',
common: {
role: 'button',
name: 'Reset mop pad lifetime',
type: 'boolean',
def: false,
read: false,
write: true,
},
native: {},
},
calc: 3600 * 0.8, // 80h
},
sensors: {
state: {
_id: 'sensors',
Expand Down Expand Up @@ -1134,7 +1163,7 @@ module.exports = {
role: 'value.state',
read: true,
write: false,
max: 30,
max: 40,
states: {
0: 'Unknown',
1: 'Initiating',
Expand Down Expand Up @@ -1165,7 +1194,13 @@ module.exports = {
26: 'Going to Mop cleaning',
27: 'Cleaning Mop paused',
28: 'Drying Mop',
29: 'Washing',
29: 'Washing Mop',
30: 'Mopping',
31: 'Cleaning and Mopping',
32: 'Remote clean',
33: 'Water inspecting',
34: 'Charging complete',
35: 'Building',
},
},
native: {},
Expand Down
4 changes: 4 additions & 0 deletions lib/stockCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ module.exports = {
method: 'reset_consumable',
params: 'main_brush_work_time',
},
mop_pad_reset: {
method: 'reset_consumable',
params: 'mop_pad_work_time',
},
side_brush_reset: {
method: 'reset_consumable',
params: 'side_brush_work_time',
Expand Down
Loading