Skip to main content

A package to control Roborock vacuums.

Project description

Roborock

PyPI Version Supported Python versions License

Roborock library for online and offline control of your vacuums.

Installation

Install this via pip (or your favourite package manager):

pip install python-roborock

Functionality

You can see all of the commands supported here

Sending Commands

Here is an example that requires no manual intervention and can be done all automatically. You can skip some steps by caching values or looking at them and grabbing them manually.

import asyncio

from roborock import HomeDataProduct, DeviceData, RoborockCommand
from roborock.version_1_apis import RoborockMqttClientV1, RoborockLocalClientV1
from roborock.web_api import RoborockApiClient

async def main():
    web_api = RoborockApiClient(username="youremailhere")
    # Login via your password
    user_data = await web_api.pass_login(password="pass_here")
    # Or login via a code
    await web_api.request_code()
    code = input("What is the code?")
    user_data = await web_api.code_login(code)

    # Get home data
    home_data = await web_api.get_home_data_v2(user_data)

    # Get the device you want
    device = home_data.devices[0]

    # Get product ids:
    product_info: dict[str, HomeDataProduct] = {
            product.id: product for product in home_data.products
        }
    # Create the Mqtt(aka cloud required) Client
    device_data = DeviceData(device, product_info[device.product_id].model)
    mqtt_client = RoborockMqttClientV1(user_data, device_data)
    networking = await mqtt_client.get_networking()
    local_device_data = DeviceData(device, product_info[device.product_id].model, networking)
    local_client = RoborockLocalClientV1(local_device_data)
    # You can use the send_command to send any command to the device
    status = await local_client.send_command(RoborockCommand.GET_STATUS)
    # Or use existing functions that will give you data classes
    status = await local_client.get_status()

asyncio.run(main())

Supported devices

You can find what devices are supported here. Please note this may not immediately contain the latest devices.

Credits

Thanks @rovo89 for https://gist.github.com/rovo89/dff47ed19fca0dfdda77503e66c2b7c7 And thanks @PiotrMachowski for https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_roborock-2.9.1.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

python_roborock-2.9.1-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

Details for the file python_roborock-2.9.1.tar.gz.

File metadata

  • Download URL: python_roborock-2.9.1.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for python_roborock-2.9.1.tar.gz
Algorithm Hash digest
SHA256 7f27763d15af67be0c71fc69cc446b2dd596efa2a3e66f1f63e56d0ce5c95e05
MD5 b94c31a8b6433d33af5954916a41b316
BLAKE2b-256 d94d66a7e42fb114620cdcdc54d26aba597734723f20fa2dc4bf6fa20969413e

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_roborock-2.9.1.tar.gz:

Publisher: ci.yml on Python-roborock/python-roborock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_roborock-2.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_roborock-2.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f009e91ec9c05ca81edfb052ac2c2c3447b9fa05f5bb3f7507f2f1855025038
MD5 ba2c4cac7c8f5c5c640b7093f93efec1
BLAKE2b-256 5d48db3b2e11eb591c49d62bef564bda99f3c3707817c7861eb25afa3eaf4a7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_roborock-2.9.1-py3-none-any.whl:

Publisher: ci.yml on Python-roborock/python-roborock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page