Request Roborock App Binding

Thanks for that… That looks promising, I will give it a try

Hey, did you manage do use the copystring 0.6.17 or even the dev brunch?

I installed various dependencies during troubleshooting, including the version of copystring/ioBroker.roborock pulled by default. I’m not 100% sure if this was required. I hoped not.

Let me know if anyone needs clarification!

I have updated the project so that the local script runs correctly. Thanks for the hint.
There is now also a develop branch, just adjust the file “prep-local-dev.sh”, that is commented out.

If some is interested to run the bridge as systemd service…

I installed the script in /opt/rr2mqtt so you might want to change that…

create a system user with:

 sudo adduser --system rr2mqtt

change the folder persmision to allow the new user access to the bridge:

chown -R rr2mqtt /opt/rr2mqtt/

and put a ne file named rr2mqtt.service in /etc/systemd/system

[Unit]
Description=Roborock2mqtt 
After=network.target

[Service]
WorkingDirectory=/opt/rr2mqtt/ioBroker.roborock/
Type=simple
Restart=always
User=rr2mqtt
ExecStart = node  --env-file=config.env  rr2mqtt-main.js 

[Install]
WantedBy=multi-user.target

After saving that file, reload the deamons, and enable autostart:

systemctl daemon-reload && systemctl enable rr2mqtt.service

I’ve tried both projects from konqi and csowada with my Q7+ Max.
I liked the look of the first, the demo in docker is nice but I could run it for real and make it talk to my robot.
csowada’s is running in a docker as are the reset of my services so that fits in well with my infrastructure, thanks for your effort.
I need to spend some more time with mqtt-explorer, I’ve not figured out yet what commands I can send. Ideally I’d like to:

  • trigger certain routines, like clean when we’ve gone out.
  • get notified when its stuck again - maybe showing where in its map it was last seen.

Also appreciate the guides on mitm snooping, will try this out on some other devices.

I’m probably going to take a look at this. My previous vacuums used the Mi Home app and work fine in OpenHAB, but I just recently bought a Roborock Qrevo S which only works with the Roborock app.

This API is reasonably well documented at Usage — Python Roborock 0.1 documentation

For me the main key is being able to automate starting a cycle via OpenHAB. The ability to run specific routines may be more problematic, but will see…

Stay tunes, hopefully over the weekend I can at least get a bridge logging into the API and autodiscovering devices. Then I can start to add some simple channels.

If/when I get something working, I’ll start a new post…

5 Likes

Progress: I have a framework committed. It doesn’t do anything yet :slight_smile:

I’m working on deciphering the login using:
Groovy code: Hubitat/roborockRobotVacuum/roborockRobotVacuum.groovy at main · bloodtick/Hubitat · GitHub
Python code: python-roborock/roborock/web_api.py at 148a6faa5c37ce619e5749da78be507e50e2b890 · Python-roborock/python-roborock · GitHub

I’m trying to login using curl - and once I figure the syntax out, I can code this in java.

Using:

curl -d '{ "email":"paul@domain.tld","password":"notmyrealpassword", "needtwostepauth":"false"}' -X POST https://usiot.roborock.com/api/v1/login

Right now, this is returning:
{“msg”:“missing parameters”,“data”:null,“code”:1001}

I know I need to create a header based on python-roborock/roborock/web_api.py at 148a6faa5c37ce619e5749da78be507e50e2b890 · Python-roborock/python-roborock · GitHub

That will be a tomorrow problem :slight_smile:

Edit: OK I’m an idiot, the correct syntax for curl is:

curl -X POST "https://euiot.roborock.com/api/v1/login?username=paul@domain.tld&password=notmyrealpassword&needtwostepauth=false"

now to update my OH code

OK so I can now login and get a token, and use this token to get a list of homes.

Next steps are to code the equivalent of Hubitat/roborockRobotVacuum/roborockRobotVacuum.groovy at main · bloodtick/Hubitat · GitHub in Java so that I should be able to retrieve a list of devices.

Update:
I’m failing with getting the house details with:

java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header

This is from openhab-addons/bundles/org.openhab.binding.roborock/src/main/java/org/openhab/binding/roborock/internal/RoborockWebTargets.java at roborock · psmedley/openhab-addons · GitHub

I’m not sure if there’s a problem with openhab-addons/bundles/org.openhab.binding.roborock/src/main/java/org/openhab/binding/roborock/internal/RoborockWebTargets.java at roborock · psmedley/openhab-addons · GitHub or something else :frowning:

Edit2: OK fixed it! After going out for lunch, and having a few red wines, found a couple of typos. Now to clean things up and get device discovery working.

Edit3: Discovery now working, and I have a completely useless (for now) thing called “Roborock Qrevo S”

Edit4: Last update for today - I have some basic read-only channels like battery status propogating to the Vacuum. To get any further, I need to do some homework on mqtt and work out how that works. Meanwhile, I’ve been ratelimited for hitting the API too much :frowning:

FYI I got a robot rock s6 maxv that as soon as you get that first channel “start vacuuming” up I’ll do a full reset and start testing your binding :wink:
Regarding local communication, do you figure you’ll be able to get something, or will you always be going through the internet? I’d really like it to know if I’ll have issues when the internet goes down.

It’s likely to take a bit of time to get that first channel. It seems pretty much all data and commands are done via mqtt - and I’ve never created a binding that does that. I have some example code in [ecoflow] Initial contribution by maniac103 · Pull Request #18525 · openhab/openhab-addons · GitHub but I need to try and understand it, and adapt the bits from the python or groovy implementations.

I also need to try and ‘cache’ some of the metadata like the python binding does to reduce unnecessary API calls.

Thanks for the interest :slight_smile:

Edit: I’m now caching the JSON from the login call, which helped to ‘un’ rate limit myself as my token was still valid. At some point, I’ll need to add a check for ‘Unauthorised’ and refresh the token, but that can wait.

Also forgot to mention, but current code is at GitHub - psmedley/openhab-addons at roborock

1 Like

Just FYI I’m adding Robotic Vacuum Cleaner support soon into the Matter binding (Matter is in 5.0 builds) , this is specifically to support the Roborock series of Matter compatible cleaners (its the only one i have access to data on ). I have the code mostly done, just finishing some unit tests for it. This would allow monitoring its operating state, sending commands (go home, clean, etc…) and selecting the areas (rooms) for cleaning. I don’t personally own one, and I’m not sure which models support matter, so take that for what it’s worth.

1 Like

Appears my Qrevo S doesn’t have Matter compatible firmware.

Here is a list of models with Matter support.
https://www.roborock.com.my/blogs/news/roborock-issues-update-for-matter-support-in-ios-18-4

Roborock remains committed to expanding Matter support across its product range. In the coming weeks and months, the company will extend compatibility to the Roborock S8 Max Ultra and Qrevo Slim, with further models to follow.

FWIW - I’m hoping I can “recycle” some of the mqtt code from the ecovacs binding by @maniac103:

&

I hope to have some time to look at this over the weekend.