Tasshack / dreame-vacuum

Home Assistant integration for Dreame robot vacuums with map support
https://community.home-assistant.io/t/custom-component-dreame-vacuum
MIT License
777 stars 93 forks source link

Support for Xiaomi Mijia Sweeping And Mopping Robot M30S D103CN #655

Open APotapoff opened 1 month ago

APotapoff commented 1 month ago

Can you add support for Xiaomi Mijia Sweeping And Mopping Robot M30S D103CN? I checked miot-spec and it looks a bit like xiaomi.vacuum.c102cn.

After that, I downloaded this integration ( v2.0.0.0b15), then added my device to custom_components/dreame_vacuum/config_flow.py. I also replaced protocol.py with https://raw.githubusercontent.com/Tasshack/dreame-vacuum/dev/custom_components/dreame_vacuum/dreame/protocol.py

Almost everything works except for a few things, most importantly Current Map and Current Room. But I can control room cleaning via Saved Map and I even generate rooms config using Vacuum Map to control cleaning by room. I also see the correct room names in the states.

List of all unavailable properties:

Checked the logs and found the error:

"Map data decryption failed: Invalid IV size (0) for CBC.... Private key might be missing, please report this issue with your device model"

image image

Additional Information

Tasshack commented 1 month ago

Looks like I can add support for xiaomi.vacuum.d103cn.

Tasshack commented 1 month ago

Integration does not have private key for this model therefore cannot decrypt the current map. Unavailable entities are related to the Map data decryption failed error but you can see saved map entity because it is not encrypted.

APotapoff commented 1 month ago

Thank you. Having looked at the previous issues, that's what I thought. Otherwise, even without the current map it is already possible to fully utilize the integration and use the automations.

Tasshack commented 1 month ago

I think M30 D102 and M30Pro C107 are also Dreame devices.

Tasshack commented 1 month ago

Thank you. Having looked at the previous issues, that's what I thought. Otherwise, even without the current map it is already possible to fully utilize the integration and use the automations.

I don't recomment for you to use the integration at this state since it will continuously try to get the initial map data at the background.

Tasshack commented 1 month ago

@APotapoff Can you try replacing this file with /custom_components/dreame_vacuum/dreame/const.py?

const.zip

APotapoff commented 1 month ago

The card's working.

image

There are still a few inaccessible propetries left, but they have more to do with the settings of the device itself. Funnily enough, I had previously seen an AI recognition setting that is not announced in this model and enabled it. It's not there now, but there is something similar to curtains on the map. Thank you very much.

List of unavailable properties(if it could be useful):

Tasshack commented 1 month ago

I need access to the device for fully supporting all of the device properties and related features because currently I cannot access the app plugin source code and even tough I can access, it will be minified unlike the Dreamehome app plugins and minifying makes it almost impossible to reverse engineer just by looking at the code and without access to a real device.

Tasshack commented 1 month ago

Auto-Add Detergent = Not Sure why it is unavailable Base Station Self Repair = Not Sure why it is unavailable Carpet Boost = Not Sure why it is unavailable Cleaning Mode Room = Not Sure why it is unavailable Cleaning Progress = Only available when cleaning Cleaning Times = Not Sure why it is unavailable Clear Warning = Only available when there is a warning Cruising History = Only available after at least one cruising Floor Material = Needs to be set from integration Mapping Time = Only available when mapping Mop Pad Humidity = Not Sure why it is unavailable Off-Peak Charging End = Only available off peak charging is enabled Off-Peak Charging Start = Only available off peak charging is enabled Reset Detergent = Only available when there is a detergent Saved Wifi Map 1 = Needs to be enabled manually from HA Self-Clean = Not Sure why it is unavailable Suction Level = Not Sure why it is unavailable

APotapoff commented 1 month ago

Share the vacuum, to acc 1724225515. Name - Vaccuum M30

APotapoff commented 1 month ago

Checked customization room properties. They are only available when the Customized Cleaning option is enabled. I was just unloading in bulk and the room names in the parameters got wiped out. That is, when the Customized Cleaning parameter is enabled, the general parameter (e.g. Cleaning Mode) becomes unavailable, but the parameters for each room become available.

Tasshack commented 1 month ago

Got it thanks. It looks very similar to the 102CN one but more advanced features are available with this one. I will add full support to the integration for this device on the next Beta release in a couple of weeks. I won't be using the device for cleaning but maybe toogle a few settings at this period.

Thanks again for your help.

Tasshack commented 1 month ago

Checked customization room properties. They are only available when the Customized Cleaning option is enabled. I was just unloading in bulk and the room names in the parameters got wiped out. That is, when the Customized Cleaning parameter is enabled, the general parameter (e.g. Cleaning Mode) becomes unavailable, but the parameters for each room become available.

This is normal behaviour of the integration since device ignores global settings (suction_level, cleaning_mode) when customized cleaning is enabled.

APotapoff commented 1 month ago

Enjoy. Whenever convenient. Thank you for your help.

Tasshack commented 1 month ago

It is also interesting that this device has Off-Peak charging feature like L20/X30/X40 but not C102CN or C102GL.

Tasshack commented 1 month ago

I really don't want to include missing features from the app to not to mess with the Dreame officials because these devices supposed to be the cheaper versions of the flagship Dreame branded ones with less features but if they don't want me to do that then they should have been removed those settings from the firmware too and not just the app.

For instance; they have removed no mopping zones from the app of C102 for no reason other than marketting.

Tasshack commented 1 month ago

Full support has been added to the latest Beta release. https://github.com/Tasshack/dreame-vacuum/releases/tag/v2.0.0b16

I had to change some entity availabilities according to the differences in app between Dreame variant of the device. I suggest removing the device from your HA and add it again for refreshing the auto generated entities.

Thanks @APotapoff for the access.

Tasshack commented 1 month ago

I see that I forgot to add the custom wetness level capability to this device but I will on the next Beta release.