DeebotUniverse / client.py

Deebot client library in python
https://deebot.readthedocs.io
GNU General Public License v3.0
28 stars 41 forks source link

Add Mopping Mode selection #443

Open Rhapsodyan opened 11 months ago

Rhapsodyan commented 11 months ago

Is there an existing issue for this?

Is your feature request related to a problem?

Hi, thanks for your wonderful work. I've an Ecovacs X10 OMNI and I've seen that there's no option for "Mopping Mode" (Standard/Deep) in your integration. I would like to add this option.

Suggested solution

I've sniffed the traffic between Ecovacs app and Ecovacs servers and I've found the command sent. See Api example request.

Api example request

{
    "app": {
        "id": "ecovacs"
    },
    "auth": {
        "realm": "ecouser.net",
        "resource": "XXXXX",
        "token": "XXXXX",
        "userid": "XXXXX",
        "with": "users"
    },
    "cmdName": "setCustomAreaMode",
    "payload": {
        "body": {
            "data": {
                "sweepMode": 1
            }
        },
        "header": {
            "pri": 1,
            "ts": "1695644868714",
            "tzm": 120,
            "ver": "0.0.50"
        }
    },
    "payloadType": "j",
    "td": "q",
    "toId": "REDACTED",
    "toRes": "TNLD",
    "toType": "1vxt52"
}

Alternatives you've considered

No response

Additional information

Let me know if you need more informations to add this feature. Thanks!

Rhapsodyan commented 11 months ago

Additional details: "sweepMode": 1 corresponds to Deep "sweepMode": 0 corresponds to Standard

edenhaus commented 11 months ago

As my bot does not have this option, I have some additional questions:

Rhapsodyan commented 11 months ago

Hi, I set this in the Cleaning Preferences, where other options such as Suction Power and Cleaning Times resides. Here’s a screenshot from the app:

IMG_7958

NEVdataDyne commented 11 months ago

This feature request is included in issue DeebotUniverse/client.py#441 but with a third sweep mode called «fast» for some robots such as the T20 omni

Ulfmerbold2000 commented 3 months ago

In the ecovacs-deebot.js this command implemented in the setWaterinfo command for the 950-type robots(they differentiate beween 950-types and non950-types)

/**
 * Sets the 'Water Flow Level'
 * (and the 'Scrubbing Pattern' for a few models)
 * @extends VacBotCommand
 */
class SetWaterLevel extends VacBotCommand {
    constructor(level, sweepType = 0) {
        // 'Water Flow Level'
        const payload = {
            'amount': level
        };
        // 'Scrubbing Pattern' (e.g. OZMO T8 AIVI)
        // 1 = 'Quick Scrubbing'
        // 2 = 'Deep Scrubbing'
        if ((sweepType === 1) || (sweepType === 2)) {
            Object.assign(payload, {'sweepType': sweepType});
        }
        super('setWaterInfo', payload);
    }
}

In my logs i found corresponding messages:

[deebot_client.mqtt_client] Got message: topic=iot/atr/onWaterInfo/310b014d-e138-4268-b4f2-eea7bc4bebfa/lf3bn4/hOdT/j, payload=b'{"header":{"pri":1,"tzm":120,"ts":"1716364281938","ver":"0.0.1","fwVer":"1.76.0","hwVer":"0.1.1","wkVer":"0.1.54"},"body":{"data":{"amount":3,"enable":1,"sweepType":1,"type":1}}}'

[deebot_client.device] Try to handle message onWaterInfo: b'{"header":{"pri":1,"tzm":120,"ts":"1716364281938","ver":"0.0.1","fwVer":"1.76.0","hwVer":"0.1.1","wkVer":"0.1.54"},"body":{"data":{"amount":3,"enable":1,"sweepType":1,"type":1}}}'

[deebot_client.messages] Falling back to legacy way for onWaterInfo

[deebot_client.event_bus] Event is the same! Skipping (WaterInfoEvent(amount=<WaterAmount.HIGH: 3>, mop_attached=True))

But i can't "write" nor expand that script for python...hardly missing skills in java and python :/

imho just needed an extension of the water_info.py and the _mqtt_params of the class SetWaterInfo needs an "OR" to diffentiate the payload from amount and sweepType of that command

Should be {"amount":3,"enable":1,"sweepType":1,"type":1} where the amount leads to the setwaterinfo command... "enable" could be the mop attached message and "sweepType" is the magic part missing what that "type" is, idk

Btw what that "falling back to legacy way" means and what the non legacy way could be, i have no clue but would be cool to know


Question: IS something like

@dataclass(frozen=True)
class onWaterInfo(EnableEvent):
    """onWaterInfo event."""
    amount: int
    enable: int
    sweepType: int
    type: int

in the init.py under events a thing what needed?

and in the water_info.py something like:

@unique
class sweepType(IntEnum):
    """Enum class for all possible sweeping Methods."""

    # Values should be sort from low to high on their meanings
    Off = 0
    Standard = 1
    Deep = 2

Makes this sense to start with?