python-roborock


Namepython-roborock JSON
Version 2.9.3 PyPI version JSON
download
home_pageNone
SummaryA package to control Roborock vacuums.
upload_time2025-01-21 04:12:32
maintainerNone
docs_urlNone
authorhumbertogontijo
requires_python<4.0,>=3.11
licenseGPL-3.0-only
keywords roborock vacuum homeassistant
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Roborock

<p align="center">
  <a href="https://pypi.org/project/python-roborock/">
    <img src="https://img.shields.io/pypi/v/python-roborock.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
  </a>
  <img src="https://img.shields.io/pypi/pyversions/python-roborock.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
  <img src="https://img.shields.io/pypi/l/python-roborock.svg?style=flat-square" alt="License">
</p>

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]("https://python-roborock.readthedocs.io/en/latest/api_commands.html")

## 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.
```python
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.ip)
    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]("https://python-roborock.readthedocs.io/en/latest/supported_devices.html").
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


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-roborock",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "roborock, vacuum, homeassistant",
    "author": "humbertogontijo",
    "author_email": "humbertogontijo@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/c2/d5/fb76a84a029eb83c44a74f001244174a27a4cb0205e0babfb094e4ea8228/python_roborock-2.9.3.tar.gz",
    "platform": null,
    "description": "# Roborock\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/python-roborock/\">\n    <img src=\"https://img.shields.io/pypi/v/python-roborock.svg?logo=python&logoColor=fff&style=flat-square\" alt=\"PyPI Version\">\n  </a>\n  <img src=\"https://img.shields.io/pypi/pyversions/python-roborock.svg?style=flat-square&logo=python&amp;logoColor=fff\" alt=\"Supported Python versions\">\n  <img src=\"https://img.shields.io/pypi/l/python-roborock.svg?style=flat-square\" alt=\"License\">\n</p>\n\nRoborock library for online and offline control of your vacuums.\n\n## Installation\n\nInstall this via pip (or your favourite package manager):\n\n`pip install python-roborock`\n\n## Functionality\n\nYou can see all of the commands supported [here](\"https://python-roborock.readthedocs.io/en/latest/api_commands.html\")\n\n## Sending Commands\n\nHere is an example that requires no manual intervention and can be done all automatically. You can skip some steps by\ncaching values or looking at them and grabbing them manually.\n```python\nimport asyncio\n\nfrom roborock import HomeDataProduct, DeviceData, RoborockCommand\nfrom roborock.version_1_apis import RoborockMqttClientV1, RoborockLocalClientV1\nfrom roborock.web_api import RoborockApiClient\n\nasync def main():\n    web_api = RoborockApiClient(username=\"youremailhere\")\n    # Login via your password\n    user_data = await web_api.pass_login(password=\"pass_here\")\n    # Or login via a code\n    await web_api.request_code()\n    code = input(\"What is the code?\")\n    user_data = await web_api.code_login(code)\n\n    # Get home data\n    home_data = await web_api.get_home_data_v2(user_data)\n\n    # Get the device you want\n    device = home_data.devices[0]\n\n    # Get product ids:\n    product_info: dict[str, HomeDataProduct] = {\n            product.id: product for product in home_data.products\n        }\n    # Create the Mqtt(aka cloud required) Client\n    device_data = DeviceData(device, product_info[device.product_id].model)\n    mqtt_client = RoborockMqttClientV1(user_data, device_data)\n    networking = await mqtt_client.get_networking()\n    local_device_data = DeviceData(device, product_info[device.product_id].model, networking.ip)\n    local_client = RoborockLocalClientV1(local_device_data)\n    # You can use the send_command to send any command to the device\n    status = await local_client.send_command(RoborockCommand.GET_STATUS)\n    # Or use existing functions that will give you data classes\n    status = await local_client.get_status()\n\nasyncio.run(main())\n```\n\n## Supported devices\n\nYou can find what devices are supported\n[here](\"https://python-roborock.readthedocs.io/en/latest/supported_devices.html\").\nPlease note this may not immediately contain the latest devices.\n\n\n## Credits\n\nThanks @rovo89 for https://gist.github.com/rovo89/dff47ed19fca0dfdda77503e66c2b7c7 And thanks @PiotrMachowski for https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "A package to control Roborock vacuums.",
    "version": "2.9.3",
    "project_urls": {
        "Documentation": "https://python-roborock.readthedocs.io/",
        "Repository": "https://github.com/humbertogontijo/python-roborock"
    },
    "split_keywords": [
        "roborock",
        " vacuum",
        " homeassistant"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2bca95ba25a08997e11f6c6a8d37fd59856dbda431252a0d0b2c87c4a32076f",
                "md5": "14cb64100224372f3d4ebc61b6828b42",
                "sha256": "b39aae72fc768b0aac9a3fe1225e14dfef10a8957a186b574a0a54380d3c3b3a"
            },
            "downloads": -1,
            "filename": "python_roborock-2.9.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14cb64100224372f3d4ebc61b6828b42",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 66022,
            "upload_time": "2025-01-21T04:12:30",
            "upload_time_iso_8601": "2025-01-21T04:12:30.029540Z",
            "url": "https://files.pythonhosted.org/packages/b2/bc/a95ba25a08997e11f6c6a8d37fd59856dbda431252a0d0b2c87c4a32076f/python_roborock-2.9.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2d5fb76a84a029eb83c44a74f001244174a27a4cb0205e0babfb094e4ea8228",
                "md5": "25237d4fcd7ec8021e39676431fa23f0",
                "sha256": "b228f8ac6b56504f42701b8086acb75cd474ae89016839ac8bf53bda889809cf"
            },
            "downloads": -1,
            "filename": "python_roborock-2.9.3.tar.gz",
            "has_sig": false,
            "md5_digest": "25237d4fcd7ec8021e39676431fa23f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 57194,
            "upload_time": "2025-01-21T04:12:32",
            "upload_time_iso_8601": "2025-01-21T04:12:32.296474Z",
            "url": "https://files.pythonhosted.org/packages/c2/d5/fb76a84a029eb83c44a74f001244174a27a4cb0205e0babfb094e4ea8228/python_roborock-2.9.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-21 04:12:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "humbertogontijo",
    "github_project": "python-roborock",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "python-roborock"
}
        
Elapsed time: 0.44590s