From f88fb3f5920a17015c14b9a46080067b1e6676b7 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 10 Nov 2024 09:22:28 -0500 Subject: [PATCH] fix: add some new roborock codes and add custom command --- poetry.lock | 154 ++++++++++++++---- pyproject.toml | 3 +- roborock/code_mappings.py | 20 +++ roborock/const.py | 1 + roborock/containers.py | 10 ++ roborock/roborock_typing.py | 1 + roborock/version_1_apis/roborock_client_v1.py | 8 +- .../version_1_apis/roborock_mqtt_client_v1.py | 17 +- 8 files changed, 179 insertions(+), 35 deletions(-) diff --git a/poetry.lock b/poetry.lock index 2d4bdf4..0db6ed3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -87,7 +87,6 @@ files = [ [package.dependencies] aiosignal = ">=1.1.2" -async-timeout = {version = ">=4.0,<5.0", markers = "python_version < \"3.11\""} attrs = ">=17.3.0" frozenlist = ">=1.1.1" multidict = ">=4.5,<7.0" @@ -242,20 +241,6 @@ files = [ {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] -[[package]] -name = "exceptiongroup" -version = "1.2.0" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, -] - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "filelock" version = "3.13.1" @@ -624,7 +609,6 @@ files = [ [package.dependencies] mypy-extensions = ">=1.0.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing-extensions = ">=4.1.0" [package.extras] @@ -682,6 +666,98 @@ files = [ [package.extras] proxy = ["PySocks"] +[[package]] +name = "pillow" +version = "11.0.0" +description = "Python Imaging Library (Fork)" +optional = false +python-versions = ">=3.9" +files = [ + {file = "pillow-11.0.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:6619654954dc4936fcff82db8eb6401d3159ec6be81e33c6000dfd76ae189947"}, + {file = "pillow-11.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b3c5ac4bed7519088103d9450a1107f76308ecf91d6dabc8a33a2fcfb18d0fba"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a65149d8ada1055029fcb665452b2814fe7d7082fcb0c5bed6db851cb69b2086"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88a58d8ac0cc0e7f3a014509f0455248a76629ca9b604eca7dc5927cc593c5e9"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:c26845094b1af3c91852745ae78e3ea47abf3dbcd1cf962f16b9a5fbe3ee8488"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:1a61b54f87ab5786b8479f81c4b11f4d61702830354520837f8cc791ebba0f5f"}, + {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:674629ff60030d144b7bca2b8330225a9b11c482ed408813924619c6f302fdbb"}, + {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:598b4e238f13276e0008299bd2482003f48158e2b11826862b1eb2ad7c768b97"}, + {file = "pillow-11.0.0-cp310-cp310-win32.whl", hash = "sha256:9a0f748eaa434a41fccf8e1ee7a3eed68af1b690e75328fd7a60af123c193b50"}, + {file = "pillow-11.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:a5629742881bcbc1f42e840af185fd4d83a5edeb96475a575f4da50d6ede337c"}, + {file = "pillow-11.0.0-cp310-cp310-win_arm64.whl", hash = "sha256:ee217c198f2e41f184f3869f3e485557296d505b5195c513b2bfe0062dc537f1"}, + {file = "pillow-11.0.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:1c1d72714f429a521d8d2d018badc42414c3077eb187a59579f28e4270b4b0fc"}, + {file = "pillow-11.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:499c3a1b0d6fc8213519e193796eb1a86a1be4b1877d678b30f83fd979811d1a"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c8b2351c85d855293a299038e1f89db92a2f35e8d2f783489c6f0b2b5f3fe8a3"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f4dba50cfa56f910241eb7f883c20f1e7b1d8f7d91c750cd0b318bad443f4d5"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:5ddbfd761ee00c12ee1be86c9c0683ecf5bb14c9772ddbd782085779a63dd55b"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:45c566eb10b8967d71bf1ab8e4a525e5a93519e29ea071459ce517f6b903d7fa"}, + {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b4fd7bd29610a83a8c9b564d457cf5bd92b4e11e79a4ee4716a63c959699b306"}, + {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cb929ca942d0ec4fac404cbf520ee6cac37bf35be479b970c4ffadf2b6a1cad9"}, + {file = "pillow-11.0.0-cp311-cp311-win32.whl", hash = "sha256:006bcdd307cc47ba43e924099a038cbf9591062e6c50e570819743f5607404f5"}, + {file = "pillow-11.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:52a2d8323a465f84faaba5236567d212c3668f2ab53e1c74c15583cf507a0291"}, + {file = "pillow-11.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:16095692a253047fe3ec028e951fa4221a1f3ed3d80c397e83541a3037ff67c9"}, + {file = "pillow-11.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d2c0a187a92a1cb5ef2c8ed5412dd8d4334272617f532d4ad4de31e0495bd923"}, + {file = "pillow-11.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:084a07ef0821cfe4858fe86652fffac8e187b6ae677e9906e192aafcc1b69903"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8069c5179902dcdce0be9bfc8235347fdbac249d23bd90514b7a47a72d9fecf4"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f02541ef64077f22bf4924f225c0fd1248c168f86e4b7abdedd87d6ebaceab0f"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:fcb4621042ac4b7865c179bb972ed0da0218a076dc1820ffc48b1d74c1e37fe9"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:00177a63030d612148e659b55ba99527803288cea7c75fb05766ab7981a8c1b7"}, + {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8853a3bf12afddfdf15f57c4b02d7ded92c7a75a5d7331d19f4f9572a89c17e6"}, + {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3107c66e43bda25359d5ef446f59c497de2b5ed4c7fdba0894f8d6cf3822dafc"}, + {file = "pillow-11.0.0-cp312-cp312-win32.whl", hash = "sha256:86510e3f5eca0ab87429dd77fafc04693195eec7fd6a137c389c3eeb4cfb77c6"}, + {file = "pillow-11.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:8ec4a89295cd6cd4d1058a5e6aec6bf51e0eaaf9714774e1bfac7cfc9051db47"}, + {file = "pillow-11.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:27a7860107500d813fcd203b4ea19b04babe79448268403172782754870dac25"}, + {file = "pillow-11.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcd1fb5bb7b07f64c15618c89efcc2cfa3e95f0e3bcdbaf4642509de1942a699"}, + {file = "pillow-11.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0e038b0745997c7dcaae350d35859c9715c71e92ffb7e0f4a8e8a16732150f38"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ae08bd8ffc41aebf578c2af2f9d8749d91f448b3bfd41d7d9ff573d74f2a6b2"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d69bfd8ec3219ae71bcde1f942b728903cad25fafe3100ba2258b973bd2bc1b2"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:61b887f9ddba63ddf62fd02a3ba7add935d053b6dd7d58998c630e6dbade8527"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:c6a660307ca9d4867caa8d9ca2c2658ab685de83792d1876274991adec7b93fa"}, + {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:73e3a0200cdda995c7e43dd47436c1548f87a30bb27fb871f352a22ab8dcf45f"}, + {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fba162b8872d30fea8c52b258a542c5dfd7b235fb5cb352240c8d63b414013eb"}, + {file = "pillow-11.0.0-cp313-cp313-win32.whl", hash = "sha256:f1b82c27e89fffc6da125d5eb0ca6e68017faf5efc078128cfaa42cf5cb38798"}, + {file = "pillow-11.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:8ba470552b48e5835f1d23ecb936bb7f71d206f9dfeee64245f30c3270b994de"}, + {file = "pillow-11.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:846e193e103b41e984ac921b335df59195356ce3f71dcfd155aa79c603873b84"}, + {file = "pillow-11.0.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4ad70c4214f67d7466bea6a08061eba35c01b1b89eaa098040a35272a8efb22b"}, + {file = "pillow-11.0.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6ec0d5af64f2e3d64a165f490d96368bb5dea8b8f9ad04487f9ab60dc4bb6003"}, + {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c809a70e43c7977c4a42aefd62f0131823ebf7dd73556fa5d5950f5b354087e2"}, + {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:4b60c9520f7207aaf2e1d94de026682fc227806c6e1f55bba7606d1c94dd623a"}, + {file = "pillow-11.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:1e2688958a840c822279fda0086fec1fdab2f95bf2b717b66871c4ad9859d7e8"}, + {file = "pillow-11.0.0-cp313-cp313t-win32.whl", hash = "sha256:607bbe123c74e272e381a8d1957083a9463401f7bd01287f50521ecb05a313f8"}, + {file = "pillow-11.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:5c39ed17edea3bc69c743a8dd3e9853b7509625c2462532e62baa0732163a904"}, + {file = "pillow-11.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:75acbbeb05b86bc53cbe7b7e6fe00fbcf82ad7c684b3ad82e3d711da9ba287d3"}, + {file = "pillow-11.0.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:2e46773dc9f35a1dd28bd6981332fd7f27bec001a918a72a79b4133cf5291dba"}, + {file = "pillow-11.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2679d2258b7f1192b378e2893a8a0a0ca472234d4c2c0e6bdd3380e8dfa21b6a"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eda2616eb2313cbb3eebbe51f19362eb434b18e3bb599466a1ffa76a033fb916"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20ec184af98a121fb2da42642dea8a29ec80fc3efbaefb86d8fdd2606619045d"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:8594f42df584e5b4bb9281799698403f7af489fba84c34d53d1c4bfb71b7c4e7"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:c12b5ae868897c7338519c03049a806af85b9b8c237b7d675b8c5e089e4a618e"}, + {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:70fbbdacd1d271b77b7721fe3cdd2d537bbbd75d29e6300c672ec6bb38d9672f"}, + {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:5178952973e588b3f1360868847334e9e3bf49d19e169bbbdfaf8398002419ae"}, + {file = "pillow-11.0.0-cp39-cp39-win32.whl", hash = "sha256:8c676b587da5673d3c75bd67dd2a8cdfeb282ca38a30f37950511766b26858c4"}, + {file = "pillow-11.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:94f3e1780abb45062287b4614a5bc0874519c86a777d4a7ad34978e86428b8dd"}, + {file = "pillow-11.0.0-cp39-cp39-win_arm64.whl", hash = "sha256:290f2cc809f9da7d6d622550bbf4c1e57518212da51b6a30fe8e0a270a5b78bd"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:1187739620f2b365de756ce086fdb3604573337cc28a0d3ac4a01ab6b2d2a6d2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fbbcb7b57dc9c794843e3d1258c0fbf0f48656d46ffe9e09b63bbd6e8cd5d0a2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d203af30149ae339ad1b4f710d9844ed8796e97fda23ffbc4cc472968a47d0b"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21a0d3b115009ebb8ac3d2ebec5c2982cc693da935f4ab7bb5c8ebe2f47d36f2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:73853108f56df97baf2bb8b522f3578221e56f646ba345a372c78326710d3830"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e58876c91f97b0952eb766123bfef372792ab3f4e3e1f1a2267834c2ab131734"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:224aaa38177597bb179f3ec87eeefcce8e4f85e608025e9cfac60de237ba6316"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:5bd2d3bdb846d757055910f0a59792d33b555800813c3b39ada1829c372ccb06"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:375b8dd15a1f5d2feafff536d47e22f69625c1aa92f12b339ec0b2ca40263273"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:daffdf51ee5db69a82dd127eabecce20729e21f7a3680cf7cbb23f0829189790"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7326a1787e3c7b0429659e0a944725e1b03eeaa10edd945a86dead1913383944"}, + {file = "pillow-11.0.0.tar.gz", hash = "sha256:72bacbaf24ac003fea9bff9837d1eedb6088758d41e100c1552930151f677739"}, +] + +[package.extras] +docs = ["furo", "olefile", "sphinx (>=8.1)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"] +fpx = ["olefile"] +mic = ["olefile"] +tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] +typing = ["typing-extensions"] +xmp = ["defusedxml"] + [[package]] name = "platformdirs" version = "4.2.0" @@ -842,11 +918,9 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=1.3.0,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -984,17 +1058,6 @@ files = [ [package.extras] tests = ["pytest", "pytest-cov"] -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - [[package]] name = "typing-extensions" version = "4.10.0" @@ -1006,6 +1069,35 @@ files = [ {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, ] +[[package]] +name = "vacuum-map-parser-base" +version = "0.1.3" +description = "Common code for vacuum map parsers" +optional = false +python-versions = "<4.0,>=3.11" +files = [ + {file = "vacuum_map_parser_base-0.1.3-py3-none-any.whl", hash = "sha256:986b51f0b6492cdff4df6a01816a1d14508273015a8a146dbb8cfc814b3abf4e"}, + {file = "vacuum_map_parser_base-0.1.3.tar.gz", hash = "sha256:e7271d426dc7f6c29f039965d6d2b8167537bee327a131d28be3c5da89b3d24f"}, +] + +[package.dependencies] +Pillow = "*" + +[[package]] +name = "vacuum-map-parser-roborock" +version = "0.1.2" +description = "Functionalities for Roborock vacuum map parsing" +optional = false +python-versions = "<4.0,>=3.11" +files = [ + {file = "vacuum_map_parser_roborock-0.1.2-py3-none-any.whl", hash = "sha256:7b66bc3af556db46f8c126793d24307d0e9117307ee1b952da1c86148c79c369"}, + {file = "vacuum_map_parser_roborock-0.1.2.tar.gz", hash = "sha256:e910b8a0349be8224fe25ca27b9ea088b66f971c30715621b3e187868bd028d0"}, +] + +[package.dependencies] +Pillow = "*" +vacuum-map-parser-base = "0.1.3" + [[package]] name = "virtualenv" version = "20.25.1" @@ -1131,5 +1223,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = "^3.10" -content-hash = "a6fa24f92d26dfa087790aa092122f82df90277823c525a8b40c2b751a829554" +python-versions = "^3.11" +content-hash = "1cbc069578252c958d33f1a2185dfc99ce5a0f433c6ad27626f0b8d96fbe5113" diff --git a/pyproject.toml b/pyproject.toml index a796ffb..17a799b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ keywords = ["roborock", "vacuum", "homeassistant"] roborock = "roborock.cli:main" [tool.poetry.dependencies] -python = "^3.10" +python = "^3.11" click = ">=8" aiohttp = "^3.8.2" async-timeout = "*" @@ -30,6 +30,7 @@ pycryptodomex = {version = "^3.18", markers = "sys_platform == 'darwin'"} paho-mqtt = "^1.6.1" dacite = "^1.8.0" construct = "^2.10.57" +vacuum-map-parser-roborock = "*" [build-system] diff --git a/roborock/code_mappings.py b/roborock/code_mappings.py index 321def2..bf82379 100644 --- a/roborock/code_mappings.py +++ b/roborock/code_mappings.py @@ -243,6 +243,15 @@ class RoborockFanSpeedQ7Max(RoborockFanPowerCode): max = 104 +class RoborockFanSpeedQRevoMaster(RoborockFanPowerCode): + quiet = 101 + balanced = 102 + turbo = 103 + max = 104 + max_plus = 105 + custom = 110 # Smartplan + + class RoborockFanSpeedP10(RoborockFanPowerCode): off = 105 quiet = 101 @@ -318,6 +327,17 @@ class RoborockMopIntensityV2(RoborockMopIntensityCode): custom = 207 +class RoborockMopIntensityQRevoMaster(RoborockMopIntensityCode): + """Describes the mop intensity of the vacuum cleaner.""" + + off = 200 + low = 201 + medium = 202 + high = 203 + custom_water_flow = 207 + custom = 209 # SmartPlan + + class RoborockMopIntensityP10(RoborockMopIntensityCode): """Describes the mop intensity of the vacuum cleaner.""" diff --git a/roborock/const.py b/roborock/const.py index 4b6b34d..e274250 100644 --- a/roborock/const.py +++ b/roborock/const.py @@ -30,6 +30,7 @@ ROBOROCK_Q7 = "roborock.vacuum.a40" ROBOROCK_Q7_MAX = "roborock.vacuum.a38" ROBOROCK_Q7PLUS = "roborock.vacuum.a40" +ROBOROCK_QREVO_MASTER = "roborock.vacuum.a117" ROBOROCK_Q8_MAX = "roborock.vacuum.a73" ROBOROCK_G10S_PRO = "roborock.vacuum.a26" ROBOROCK_G10S = "roborock.vacuum.a46" diff --git a/roborock/containers.py b/roborock/containers.py index 862bb4a..555733e 100644 --- a/roborock/containers.py +++ b/roborock/containers.py @@ -22,6 +22,7 @@ RoborockFanPowerCode, RoborockFanSpeedP10, RoborockFanSpeedQ7Max, + RoborockFanSpeedQRevoMaster, RoborockFanSpeedS6Pure, RoborockFanSpeedS7, RoborockFanSpeedS7MaxV, @@ -30,6 +31,7 @@ RoborockInCleaning, RoborockMopIntensityCode, RoborockMopIntensityP10, + RoborockMopIntensityQRevoMaster, RoborockMopIntensityS5Max, RoborockMopIntensityS6MaxV, RoborockMopIntensityS7, @@ -51,6 +53,7 @@ ROBOROCK_G10S_PRO, ROBOROCK_P10, ROBOROCK_Q7_MAX, + ROBOROCK_QREVO_MASTER, ROBOROCK_QREVO_MAXV, ROBOROCK_QREVO_PRO, ROBOROCK_QREVO_S, @@ -515,6 +518,12 @@ class Q7MaxStatus(Status): water_box_mode: RoborockMopIntensityV2 | None = None +@dataclass +class QRevoMasterStatus(Status): + fan_power: RoborockFanSpeedQRevoMaster | None = None + water_box_mode: RoborockMopIntensityQRevoMaster | None = None + + @dataclass class S6MaxVStatus(Status): fan_power: RoborockFanSpeedS7MaxV | None = None @@ -572,6 +581,7 @@ class S8MaxvUltraStatus(Status): ROBOROCK_S4_MAX: S4MaxStatus, ROBOROCK_S5_MAX: S5MaxStatus, ROBOROCK_Q7_MAX: Q7MaxStatus, + ROBOROCK_QREVO_MASTER: QRevoMasterStatus, ROBOROCK_S6: S6PureStatus, ROBOROCK_S6_MAXV: S6MaxVStatus, ROBOROCK_S6_PURE: S6PureStatus, diff --git a/roborock/roborock_typing.py b/roborock/roborock_typing.py index 3def680..9ebf259 100644 --- a/roborock/roborock_typing.py +++ b/roborock/roborock_typing.py @@ -116,6 +116,7 @@ class RoborockCommand(str, Enum): GET_MAP_STATUS = "get_map_status" GET_MAP_V1 = "get_map_v1" GET_MAP_V2 = "get_map_v2" + GET_MAP_CALIBRATION = "get_map_calibration" # Custom command GET_MOP_MOTOR_STATUS = "get_mop_motor_status" GET_MOP_TEMPLATE_PARAMS_BY_ID = "get_mop_template_params_by_id" GET_MOP_TEMPLATE_PARAMS_SUMMARY = "get_mop_template_params_summary" diff --git a/roborock/version_1_apis/roborock_client_v1.py b/roborock/version_1_apis/roborock_client_v1.py index ddf1f3f..95f4de3 100644 --- a/roborock/version_1_apis/roborock_client_v1.py +++ b/roborock/version_1_apis/roborock_client_v1.py @@ -56,10 +56,14 @@ ) from roborock.util import RepeatableTask, unpack_list -COMMANDS_SECURED = [ +COMMANDS_SECURED = { RoborockCommand.GET_MAP_V1, RoborockCommand.GET_MULTI_MAP, -] +} + +CUSTOM_COMMANDS = {RoborockCommand.GET_MAP_CALIBRATION} + +CLOUD_REQUIRED = COMMANDS_SECURED.union(CUSTOM_COMMANDS) WASH_N_FILL_DOCK = [ RoborockDockTypeCode.empty_wash_fill_dock, diff --git a/roborock/version_1_apis/roborock_mqtt_client_v1.py b/roborock/version_1_apis/roborock_mqtt_client_v1.py index e06647b..7a7a288 100644 --- a/roborock/version_1_apis/roborock_mqtt_client_v1.py +++ b/roborock/version_1_apis/roborock_mqtt_client_v1.py @@ -2,6 +2,10 @@ import base64 import paho.mqtt.client as mqtt +from vacuum_map_parser_base.config.color import ColorsPalette +from vacuum_map_parser_base.config.image_config import ImageConfig +from vacuum_map_parser_base.config.size import Sizes +from vacuum_map_parser_roborock.map_data_parser import RoborockMapDataParser from roborock.cloud_api import RoborockMqttClient @@ -13,7 +17,7 @@ RoborockMessageProtocol, ) from ..roborock_typing import RoborockCommand -from .roborock_client_v1 import COMMANDS_SECURED, RoborockClientV1 +from .roborock_client_v1 import COMMANDS_SECURED, CUSTOM_COMMANDS, RoborockClientV1 class RoborockMqttClientV1(RoborockMqttClient, RoborockClientV1): @@ -66,10 +70,21 @@ async def _send_command( method: RoborockCommand | str, params: list | dict | int | None = None, ): + if method in CUSTOM_COMMANDS: + # When we have more custom commands do something more complicated here + return await self._get_calibration_points() request_id, timestamp, payload = self._get_payload(method, params, True) request_protocol = RoborockMessageProtocol.RPC_REQUEST roborock_message = RoborockMessage(timestamp=timestamp, protocol=request_protocol, payload=payload) return await self.send_message(roborock_message) + async def _get_calibration_points(self): + map: bytes = await self.send_command(RoborockCommand.GET_MAP_V1) + parser = RoborockMapDataParser(ColorsPalette(), Sizes(), [], ImageConfig(), []) + parsed_map = parser.parse(map) + calibration = parsed_map.calibration() + self._logger.info(parsed_map.calibration()) + return calibration + async def get_map_v1(self) -> bytes | None: return await self.send_command(RoborockCommand.GET_MAP_V1)