Xiaomi mi vacuum cleaner (also Roborock)

frankly that’s awesome. I’m glad someone is finally doing it.
I tried getting it attached to my hass.io, did, but would rather use smartthings.

I really appreciate this.
I put a post on smartthings reddit to try and get this attached as a device handler.
Hopefully we can. I just want to control it so that it doesn’t go off if someone is there, then goes back to the dock if someone comes home.
It’d be cool to be able to have it resume after docking so that it goes during a certain time, but that gets more complicated.

Thanks for the start though man. Really appreciate it.

1 Like

I will be ordering one soon, ill put it on my hass.io setup
But again i would like to use it in webcore

Is there any way i can control via webcore a hassio device?

Huge thanks for getting this started. Personally I want to be able to set a routine off in ST using Alexa voice commands! Annoyingly the Alexa Xiaomi skill is for the Singapore server and I need to keep mine to UK. Adding this bad boy to ST would be so good…so I hope someone can turn it into a DH :slight_smile: Thanks for all your work though.

Technically that works now (if you go through all the work above) since its just a ST switch.

I’m still trying to work through ways to make this work much easier, but I’m no ST dev so I’m flying somewhat blind at this point. :wink:

Haha I’m sure! That said, I’m still struggling with “Install Python-miio” :joy: And I thought I was competent in IT!

And since I don’t have the first clue about writing DH, I’m wondering if I couldn’t use WebCoRE to calculate and submit the necessary JSON (I’m guessing) requests to make this work with no intermediary.

The only problem I can see with that is its a horrible hack with no way to retrieve status, only turn on/turn off.

If you happen to have a Ubuntu desktop (virtual is fine), then these instructions should be all you need to get python-miio installed:
https://python-miio.readthedocs.io/en/latest/discovery.html#installation

Sadly I don’t have a Ubuntu desktop, I’m sure I could sort it at some point though. Does your solution work without an intermediary?

Not currently. Python-miio is needed because it calculates and submits the data in the correct form to Xiaomi. In theory, that part might be able to be done in WebCoRE. It’s really an atrocious hack though.

And technically it would still require an intermediary, called WebCoRE…

An atrocious hack sounds pretty dirty to me, but then, it’s for a vacuum so could be forgiven. Does WebCoRE need an intermediary device?

No, it would require nothing more than ST and WebCoRE. In theory you’d just copy the piston, add in the IP and token of your vacuum, and you’d be able to tell it to start and stop.

I have no idea if I can even make that work though. LOL

just spitballin…

You go girl! Haha :stuck_out_tongue: But seriously, it would be so cool if you could make it work!!!

Just ordered one, confident i might get it to work if i can integrate it in home assistant

2 Likes

Would be AWESOME if you could Eddie!

It wasn’t too hard to get it into home assistant.

hopefully you got it working!

So while it’s still extremely complicated, I’ve made some slight improvements using Docker. It goes a little something like this:

How to get your Access Token: https://home-assistant.io/components/vacuum.xiaomi_miio/#retrieving-the-access-token
Docker files: https://www.dropbox.com/s/bj6zru4ha4nqd3m/Xioami-v.0.1.zip?dl=0

  1. Install and configure Docker on your control PC. Setup WebCoRE.

  2. From the Docker files, open express.js and insert the IP address and token of your vacuum. Build your Docker container. This container is still large because I’m still trying to understand how Docker works (~500MB). Deal with it! :smiley:

  3. Run your newly created container (forwarding port 3000 through the host). Make sure that you can browse to http://localhost:3000/ and get a reply.

  4. Create a simulated switch in the ST IDE.

  5. Using your new switch, create a WebCoRE piston like below that points to http://YOUR.IP:3000/start and http://YOUR.IP:3000/home

  1. Control the starting and stopping of your vacuum with the new switch.

Now enjoy a nice beer after spending countless hours to do something that can be done in the app in seconds!

Question: why are you using docker?

Isn’t there an integration with smartthings that we can use to create a device that way? Just trying to figure out why my computer needs to run a program to have this work…

If there was, I wouldn’t be using Docker… The Dockerfile sets up the Express web server, which takes calls from WebCoRE and then executes python commands locally to activate the vacuum.

As an alternative, you could install Home Assistant. Either way, you’re going to have to install a third party tool.

1 Like

lol still have not received mine yet. But yeah my end goal is to use home assistant and using webcore to trigger it

I cant seem to be able to extract my token,

do you have any tips on this?
im using the Mitoolkit

I am using the android/windows method
so i download mitoolkit, plug in my phone etc… click on extract token, get the prompt for do not enter password
at the end it says
"there seems to be an error with the backup, it is way too small"

I kept running into the error. Do you have your adb settings set up too?
cause you also have to authorize it.
Go into your settings, find your versions, click build like 5 to 10 times
to open developer options,
go into developer options and turn on USB Debugging. the next time you plug
your phone in and run the program you should have to click like yes or
accept to allow your computer to connect.

I’m pretty sure it’s your usb debugging that needs to get fixed.

if that doesn’t work… I would go back to a version that was like 1.5 to
extract the tokens.
I have two and had to do this too.

1 Like