feat(vendor.dreame): Wheel consumable monitoring

This commit is contained in:
Sören Beye 2025-01-06 09:57:40 +01:00
parent 6161901d0b
commit 1eda6ef56f
7 changed files with 93 additions and 1 deletions

View File

@ -306,6 +306,7 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot {
case MIOT_SERVICES.MOP.SIID:
case MIOT_SERVICES.SECONDARY_FILTER.SIID:
case MIOT_SERVICES.DETERGENT.SIID:
case MIOT_SERVICES.WHEEL.SIID:
case MIOT_SERVICES.MOP_EXPANSION.SIID:
case MIOT_SERVICES.MISC_STATES.SIID:
this.parseAndUpdateState([e]);
@ -652,6 +653,7 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot {
case MIOT_SERVICES.MOP.SIID:
case MIOT_SERVICES.SECONDARY_FILTER.SIID:
case MIOT_SERVICES.DETERGENT.SIID:
case MIOT_SERVICES.WHEEL.SIID:
if (this.capabilities[ConsumableMonitoringCapability.TYPE]) {
this.capabilities[ConsumableMonitoringCapability.TYPE].parseConsumablesMessage(elem);
}

View File

@ -90,6 +90,10 @@ class DreameL40UltraValetudoRobot extends DreameGen4ValetudoRobot {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.PROPERTIES.TIME_LEFT.PIID
},
wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.PROPERTIES.TIME_LEFT.PIID
}
},
miot_actions: {
reset_main_brush: {
@ -108,6 +112,10 @@ class DreameL40UltraValetudoRobot extends DreameGen4ValetudoRobot {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.ACTIONS.RESET.AIID
},
reset_wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.ACTIONS.RESET.AIID
}
},
}));

View File

@ -657,6 +657,22 @@ module.exports = {
PIID: 4
}
}
}
},
WHEEL: {
SIID: 30,
PROPERTIES: {
TIME_LEFT: { //Hours
PIID: 1
},
PERCENT_LEFT: {
PIID: 2
}
},
ACTIONS: {
RESET: {
AIID: 1
}
}
},
})
};

View File

@ -90,6 +90,10 @@ class DreameMovaP10ProUltraValetudoRobot extends DreameGen4ValetudoRobot {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.PROPERTIES.TIME_LEFT.PIID
},
wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.PROPERTIES.TIME_LEFT.PIID
}
},
miot_actions: {
reset_main_brush: {
@ -108,6 +112,10 @@ class DreameMovaP10ProUltraValetudoRobot extends DreameGen4ValetudoRobot {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.ACTIONS.RESET.AIID
},
reset_wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.ACTIONS.RESET.AIID
}
},
}));

View File

@ -89,6 +89,10 @@ class DreameX40MasterValetudoRobot extends DreameGen4ValetudoRobot {
sensor: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.PROPERTIES.TIME_LEFT.PIID
},
wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.PROPERTIES.TIME_LEFT.PIID
}
},
miot_actions: {
@ -107,6 +111,10 @@ class DreameX40MasterValetudoRobot extends DreameGen4ValetudoRobot {
reset_sensor: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.ACTIONS.RESET.AIID
},
reset_wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.ACTIONS.RESET.AIID
}
},
}));

View File

@ -89,6 +89,10 @@ class DreameX40UltraValetudoRobot extends DreameGen4ValetudoRobot {
sensor: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.PROPERTIES.TIME_LEFT.PIID
},
wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
piid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.PROPERTIES.TIME_LEFT.PIID
}
},
miot_actions: {
@ -107,6 +111,10 @@ class DreameX40UltraValetudoRobot extends DreameGen4ValetudoRobot {
reset_sensor: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.SENSOR.ACTIONS.RESET.AIID
},
reset_wheel: {
siid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.SIID,
aiid: DreameGen2ValetudoRobot.MIOT_SERVICES.WHEEL.ACTIONS.RESET.AIID
}
},
}));

View File

@ -40,6 +40,10 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
* @param {object} [options.miot_actions.reset_detergent]
* @param {number} options.miot_actions.reset_detergent.siid
* @param {number} options.miot_actions.reset_detergent.aiid
*
* @param {object} [options.miot_actions.reset_wheel]
* @param {number} options.miot_actions.reset_wheel.siid
* @param {number} options.miot_actions.reset_wheel.aiid
*
*
* @param {object} options.miot_properties
@ -70,6 +74,10 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
* @param {object} [options.miot_properties.detergent]
* @param {number} options.miot_properties.detergent.siid
* @param {number} options.miot_properties.detergent.piid
*
* @param {object} [options.miot_properties.wheel]
* @param {number} options.miot_properties.wheel.siid
* @param {number} options.miot_properties.wheel.piid
*/
constructor(options) {
super(options);
@ -108,6 +116,10 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
props.push(this.miot_properties.detergent);
}
if (this.miot_properties.wheel) {
props.push(this.miot_properties.wheel);
}
const response = await this.robot.sendCommand("get_properties", props.map(e => {
return Object.assign({}, e, {did: this.robot.deviceId});
@ -164,6 +176,11 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
payload = this.miot_actions.reset_sensor;
}
break;
case ConsumableStateAttribute.SUB_TYPE.WHEEL:
if (this.miot_actions.reset_wheel) {
payload = this.miot_actions.reset_wheel;
}
break;
}
break;
@ -315,6 +332,20 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
}
});
}
} else if (
this.miot_properties.wheel &&
msg.siid === this.miot_properties.wheel.siid
) {
if (msg.piid === this.miot_properties.wheel.piid) {
consumable = new ConsumableStateAttribute({
type: ConsumableStateAttribute.TYPE.CLEANING,
subType: ConsumableStateAttribute.SUB_TYPE.WHEEL,
remaining: {
value: Math.round(Math.max(0, msg.value * 60)),
unit: ConsumableStateAttribute.UNITS.MINUTES
}
});
}
}
}
@ -391,6 +422,17 @@ class DreameConsumableMonitoringCapability extends ConsumableMonitoringCapabilit
);
}
if (this.miot_properties.wheel) {
availableConsumables.push(
{
type: ConsumableStateAttribute.TYPE.CLEANING,
subType: ConsumableStateAttribute.SUB_TYPE.WHEEL,
unit: ConsumableStateAttribute.UNITS.MINUTES,
maxValue: 30 * 60
}
);
}
return {
availableConsumables: availableConsumables
};