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
706 stars 91 forks source link

Support for new Xiaomi Robot Vacuum X20+ #498

Open stich86 opened 2 months ago

stich86 commented 2 months ago

Can you please add support for Xiaomi Robot Vacuum X20+?
It's the twin of Dreame L10s Ultra

Currently when I add new account, it says that no robot has been found.

Thanks in advance

Tasshack commented 2 months ago

Which version are you using? Also I need the full model number.

stich86 commented 2 months ago

here is it: xiaomi.vacuum.c102gl firmware version: 4.3.9_1066

Tasshack commented 2 months ago

I cannot access the miot right now to check it but that device probably not manufactured by Dreame therefore cannot be used with this integration. I will notify you when miot-stats will be availabile again.

Tasshack commented 2 months ago

I can add it to the supported devices list if I can confirm that this is actually the same device with the L10s Ultra as you claimed.

stich86 commented 2 months ago

here is it: xiaomi.vacuum.c102gl

i've tried to add it to config_flow.py , but when it sends token there is no response from the device :(

Tasshack commented 2 months ago

here is it: xiaomi.vacuum.c102gl

i've tried to add to config_flow.py , but when it send token there is no response from the device :(

You need to select Prefer Cloud Connection since Dreame has disabled the local api recently. Also adding it to the config flow would not be enough since integration requires private key of the map for decoding it. Also if your are using the Beta, integration would require model capabilities to work properly.

stich86 commented 2 months ago

here is it: xiaomi.vacuum.c102gl

i've tried to add to config_flow.py , but when it send token there is no response from the device :(

You need to select Prefer Cloud Connection since Dreame has disabled the local api recently. Also adding it to the config flow would not be enough since integration requires private key of the map for decoding it. Also if your are using the Beta, integration would require model capabilities to work properly.

ok, i'll wait your feedback if it's possible to add or not thanks :)

Tasshack commented 2 months ago

You can at least try to add the device using the Beta version of the integration by adding it to the config flow but just to confirm that this is a Dreame device. But remove it just after the confirmatiun to not to break anything until the new version is available.

Tasshack commented 2 months ago

I would be very nice if you enable the info logs and share me too.

stich86 commented 2 months ago

You can at least try to add the device using the Beta version of the integration by adding it to the config flow but just to confirm that this is a Dreame device. But remove it just after the confirmatiun to not to break anything until the new version is available.

i've seen that in the latest beta13 there was xiaomi.vacuum.c102cn, this one is c102gl (I presume global version because it's sold in Italy)

Which flags do I need to enable debug? It's not a problem for me to share logs :)

stich86 commented 2 months ago

ok looks like it attach after change c102cn to c102gl and use cloud connection (some items are missing, may be because not fully supported) - for instance, this version doesn't have detergent tank:

image image image image
Tasshack commented 2 months ago

Yeah it is the same device with same firmware but its model name still needs to be in the keystore list otherwise you cannot use the map function.

I won't be releasing a new version soon but I can send you the files need to be changed to make this device properly when I am available in couple of days.

stich86 commented 2 months ago

Yeah it is the same device with same firmware but its model name still needs to be in the keystore list otherwise you cannot use the map function.

I won't be releasing a new version soon but I can send you the files need to be changed to make this device properly when I am available in couple of days.

that sounds good :)

i'm waiting your info, ATM i've added it so I can use basic command :)

Tasshack commented 2 months ago

You can use basic services like start, stop but i don't recommend changing any setting because robot does not have checks for any wrong parameter and everything is only limited by the app. So if you try to change a setting on a device that does not support it, it still tries to do the related work and may break things with the operation. As you already see, it still advertises the detergent settings even it does not have it, thats why integration needs to know capabilities of each model.

alexflcl commented 2 months ago

Also looking for these archives or implementation. Receiving mine in 3 days.

Thank you!

joseluislucio commented 2 months ago

Another one waiting for the X20+ integration :)

gabriel-gfs commented 2 months ago

Also patiently waiting for the integration 😊

mc-flash commented 2 months ago

Last week Xiaomi started to sell the X20+ in Germany and I'm sure many guys are now waiting for the updated integration.

Thanks in advance @Tasshack

papst01 commented 2 months ago

Got mine yesterday. Also waiting to get the integration working. Thx in advance

radim-ek commented 1 month ago

miot-spec : https://home.miot-spec.com/spec/xiaomi.vacuum.c102gl Can I help with add this device? Thanks.

martindybal commented 1 month ago

@Tasshack @radim-ek Hi, I just got mine. I'm a developer so I can help with testing or development. Does anyone working on it?

gunnm80 commented 1 month ago

ok. Thank you. Let me know if there is anything I can do to help. Is Ko-Fi not an issue for you?

privedentsev commented 1 month ago

@Tasshack очень ждем интеграцию от Вас! Огромное спасибо за Ваши труды!

Tasshack commented 1 month ago

Support for xiaomi.vacuum.c102gl has been added on latest Beta release. https://github.com/Tasshack/dreame-vacuum/releases/tag/v2.0.0b15

Tasshack commented 1 month ago

ok. Thank you. Let me know if there is anything I can do to help. Is Ko-Fi not an issue for you?

https://www.ko-fi.com/Tasshack

privedentsev commented 1 month ago

@Tasshack My card doesn't work.

mc-flash commented 1 month ago

@privedentsev I have the same problem and no idea what to do.

Found an old issue about that: https://github.com/Tasshack/dreame-vacuum/issues/229 The guy there uses HA in docker, maybe that's the problem. But I'm using HA OS... ?!

martindybal commented 1 month ago

I can confirm basic functionality. But map is not working

image image

image

Tasshack commented 1 month ago

Have you checked the logs. This probably happening because the private key of the map is not the same with the xiaomi.vacuum.120cn. I cannot confirm this because miot does not have the plugin for device yet but i dont know where app downloads it. I need the model app plugin to get the map private key and put it in the integration.

mc-flash commented 1 month ago

Thanks for your quick answer!

Here are some of the logs (got even some more problems from the integration):

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.dreame_vacuum.dreame.protocol Quelle: custom_components/dreame_vacuum/dreame/protocol.py:997 Integration: Dreame Vacuum (Dokumentation, Probleme) Erstmals aufgetreten: 04:25:10 (12 Vorkommnisse) Zuletzt protokolliert: 08:41:12

Error while executing request: https://de.api.io.mi.com/app/v2/home/rpc/1064917535 HTTPSConnectionPool(host='de.api.io.mi.com', port=443): Read timed out. (read timeout=5)

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.dreame_vacuum.dreame.map Quelle: custom_components/dreame_vacuum/dreame/map.py:237 Integration: Dreame Vacuum (Dokumentation, Probleme) Erstmals aufgetreten: 08:39:52 (1 Vorkommnisse) Zuletzt protokolliert: 08:39:52

Getting map_data from cloud failed

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.dreame_vacuum.dreame.map Quelle: custom_components/dreame_vacuum/dreame/map.py:293 Integration: Dreame Vacuum (Dokumentation, Probleme) Erstmals aufgetreten: 00:00:00 (12 Vorkommnisse) Zuletzt protokolliert: 08:41:56

Send request map failed: Unable to discover the device over cloud

Tasshack commented 1 month ago

I don't know what can I do with the read timeout error. Integration is working with the CN version of the device but I still don't understand why map is not working with the EU model.

mc-flash commented 1 month ago

I can't help you with coding but whatever you think is worth trying, just tell me/ us.

I'm using the Mi Home App modified by Vevs. Is it there maybe possible to find out where the map is saved?

Tasshack commented 1 month ago

I'm using the Mi Home App modified by Vevs.

I am not familiar with this, what is the modification?

Is it there maybe possible to find out where the map is saved?

No, that's the whole reason integration won't work offline.

Tasshack commented 1 month ago

If the device is not responding to the map data api request, probably it won't be responding to the other commands like changing a setting or starting cleaning too. This is a behaviour that I have seen on region locked Dreame devices when nation is unmatched.

Can anyone confirm this?

gunnm80 commented 1 month ago

So the commands such as “Start Fast Mapping” or “Start Mapping” work for me. This morning I briefly had a map under the “Current Map” entry after “Start Fast Mapping”. But unfortunately not the complete map and unfortunately it has disappeared again. What also works well are the current values and statuses such as “Charging Status” or “Task Status”.

mc-flash commented 1 month ago

I am not familiar with this, what is the modification?

Modified app can handle all region locked Xiaomi devices on the same server. I have STYJ02YM vacuum, chinese version. With this app I can use it on German server.

I thought we could maybe log the traffic in the app to take a look where in the cloud the map is stored. Just an idea of a salesman :)

Tasshack commented 1 month ago

Modified app can handle all region locked Xiaomi devices on the same server. I have STYJ02YM vacuum, chinese version. With this app I can use it on German server.

This may be the reason why the integration is not working so I need to know what modification has been made to the app but I really don't have time for this right now also most of the information about the modified app is in Russian so I won't be installing it to any of my devices.

I thought we could maybe log the traffic in the app to take a look where in the cloud the map is stored.

Good luck logging an ssl encrypted traffic on a recent mobile OS.

privedentsev commented 1 month ago

причиной

Modified app can handle all region locked Xiaomi devices on the same server. I have STYJ02YM vacuum, chinese version. With this app I can use it on German server.

This may be the reason why the integration is not working so I need to know what modification has been made to the app but I really don't have time for this right now also most of the information about the modified app is in Russian so I won't be installing it to any of my devices.

I thought we could maybe log the traffic in the app to take a look where in the cloud the map is stored.

Good luck logging an ssl encrypted traffic on a recent mobile OS.

У меня прекрасно все работает в родном приложении, не только карты. Весь функционал ведет себя правильно. Версия пылесоса gl, регион MiHome - RU

Tasshack commented 1 month ago

@privedentsev if you won't be using English please don't write anything.

privedentsev commented 1 month ago

@Tasshack I tested an HA vacuum cleaner with this integration. All functionality of the vacuum cleaner works perfectly. I have the native MiHome application, vacuum cleaner GL version, region RU

privedentsev commented 1 month ago

@Tasshack I also added a vacuum cleaner to the Miot integration, but there it is limited in functionality Снимок экрана 2024-06-11 в 19 47 19

Tasshack commented 1 month ago

I need full log output from a not working device.

logger:
  default: warn
  logs:
    custom_components.dreame_vacuum: debug
Tasshack commented 1 month ago

Fastest way for me to fix this issue is reproducing it on my setup and for that I need someone willing to share their device with my MiHome account.

privedentsev commented 1 month ago

Fastest way for me to fix this issue is reproducing it on my setup and for that I need someone willing to share their device with my MiHome account.

I'm ready, what should I do?

stich86 commented 1 month ago

Fastest way for me to fix this issue is reproducing it on my setup and for that I need someone willing to share their device with my MiHome account.

I can share mine if you want, just don't start it during the night 😂

Tasshack commented 1 month ago

I won't be controlling the device in anyway. I just try to make it get the map data object name and file.

Account ID: 1724225515

stich86 commented 1 month ago

1724225515

Shared let me know (it's called Duster 😅)

Tasshack commented 1 month ago

@stich86 got the access, reproduced the issue, understand the reason and fixed it. Thanks

Turns out the changes that I have made for 102cn version to work correctly causes map data to not to be retrieved on EU model because CN version uses the V3 and latest version of the cloud storage access endpoint but I didn't know that the EU model still uses old cloud api. I will make the changes for integration use V3 api endpoints only when connected to the CN server but I need to make sure this is not a firmware version related issue and won't be changed after a firmware upgrade.

@stich86 app says there is a new version of the firmware available, is that a specific reason that you did not upgrade your device or can I start upgrade to make sure integration still be working fine after the upgrade especially with the changes I have made now?

stich86 commented 1 month ago

If you want to test proceed to upgrade. No problem for me :)

I need to make sure the device still be using the old storage cloud api after the upgrade otherwise integration won't be working again like now after my fix.

Tasshack commented 1 month ago

@stich86 I cannot see the firmware upgrade menu in settings because I am not the owner of the device. App asked me when I have first added the device but I cannot upgrade it now since I have dismissed that popup. Can you start upgrade from your app?