humbertogontijo / homeassistant-roborock Goto Github PK
View Code? Open in Web Editor NEWRoborock integration for Home Assistant. This integration uses your devices from the Roborock App
License: GNU General Public License v3.0
Roborock integration for Home Assistant. This integration uses your devices from the Roborock App
License: GNU General Public License v3.0
First off, absolutely fantastic work on this integration, it’s awesome!
I was wondering what is a good way to update the vacuum’s attributes when changing things such as the fan/mop/mode.
For instance, I’m making a card where I have buttons for those three settings where each press cycles through each option sequentially (didn’t want to deal with drop downs or extra buttons). And each click I make I can immediately hear my vacuum chime notifying me that I changed a setting. Yet my card is relying on the integration waiting to update to see that I had just changed the fan speed, for instance. So it’ll basically look very laggy when viewing it, but we know the setting has been changed on the vacuum.
I’m assuming it’s not a good idea to change anything with the scan interval to avoid api rate limits, so I was wondering if it’s possible for the integration to send one-off requests to update the attributes whenever there is a command that specifically changes the attributes is made?
When Roborock S7 MaxV gets stuck its status is "Error"
I tried to figure out where i could read logs for this but I couldn't find it in homeassistant.
In offical Roborock app the notification was "Roborock S7 MaxV: Robot trapped. Clear away any obstacles surrounding it"
if necessary, I can reproduce the error. Just let me know what you need.
Also noticed that after getting stuck and status set to "error" after a little while status changed to "Charger disconnected" that is fine but after i came home and clicked on the robot to resume status did not change while cleaning.
When it went back at the dock for cleaning the mop status was still "Charger disconnected" until i manually reloaded it in Integrations. After that status changed to "Washing the mop" ass it should
It was working well until v0.0.1
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/roborock/api.py:299
Integration: Roborock (documentation, issues)
First occurred: 6:34:50 PM (2 occurrences)
Last logged: 6:36:17 PM
Error setting up entry Upstairs for roborock
Traceback (most recent call last):
File "/Users/pi/.homeassistant-venv/lib/python3.9/site-packages/homeassistant/config_entries.py", line 372, in async_setup
result = await component.async_setup_entry(hass, self)
File "/Users/pi/.homeassistant/custom_components/roborock/__init__.py", line 37, in async_setup_entry
home_data = await loop.run_in_executor(
File "/usr/local/Cellar/[email protected]/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/pi/.homeassistant/custom_components/roborock/api.py", line 346, in get_home_data
header_clientid = self._get_header_client_id()
File "/Users/pi/.homeassistant/custom_components/roborock/api.py", line 299, in _get_header_client_id
md5.update(self._device_identifier.encode())
AttributeError: 'NoneType' object has no attribute 'encode'
Thank you for the great work! I noticed that the vacuum entity history is not persistent between HA restarts. Is it a missing feature or a bug?
Also, a side "bug", when I start cleaning from the Roborock app, the HA does not seem to demonstrate any change in the state, the vacuum just shows "Docked".
Roborock supports multiple maps, which is handy for people with multi-level homes. Currently, the integration has one 'camera' sensor which is the map selected inside the app. Is it possible to retrieve all each map and store it as a sensor?
After updating to 0.0.9 I get a bunch of these in the log
[custom_components.roborock] Unexpected error fetching roborock data: 'int' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/roborock/__init__.py", line 80, in _async_update_data
device_prop = await self.api.get_prop(device_id)
File "/config/custom_components/roborock/api/api.py", line 320, in get_prop
if len(clean_summary.records) > 0:
File "/config/custom_components/roborock/api/containers.py", line 790, in records
return self.data.get(CleanSummaryField.RECORDS)
AttributeError: 'int' object has no attribute 'get'
2022-12-29 12:40:29.971 ERROR (MainThread) [custom_components.roborock.api.api] Roborock mqtt client disconnected (rc: 7)
I've been running the integration on v0.0.12 for the past ~12 hours and I'm seeing a lot of the warnings below. They don't seem to correspond to any of the other errors I'm seeing in the logs.
Logger: asyncio
Source: runner.py:120
First occurred: December 29, 2022, 9:03:06 PM (38 occurrences)
Last logged: 6:12:12 AM
Executing <Task pending name='Task-37654' coro=<RoborockMqttClient.get_clean_summary() running at /config/custom_components/roborock/api/api.py:306> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/local/python/lib/python3.10/asyncio/base_events.py:424> cb=[gather.<locals>._done_callback() at /usr/local/python/lib/python3.10/asyncio/tasks.py:714] created at /usr/local/python/lib/python3.10/asyncio/tasks.py:634> took 0.239 seconds
Executing <Task pending name='Task-37655' coro=<RoborockMqttClient.get_consumable() running at /config/custom_components/roborock/api/api.py:314> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/local/python/lib/python3.10/asyncio/base_events.py:424> cb=[gather.<locals>._done_callback() at /usr/local/python/lib/python3.10/asyncio/tasks.py:714] created at /usr/local/python/lib/python3.10/asyncio/tasks.py:634> took 0.230 seconds
Executing <Task pending name='Task-37684' coro=<DataUpdateCoordinator._handle_refresh_interval() running at /usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py:168> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/local/python/lib/python3.10/asyncio/base_events.py:424> created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:483> took 0.240 seconds
Executing <Task finished name='Task-39746' coro=<DataUpdateCoordinator._handle_refresh_interval() done, defined at /usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py:165> result=None created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:483> took 0.147 seconds
Executing <Task finished name='Task-44402' coro=<DataUpdateCoordinator._handle_refresh_interval() done, defined at /usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py:165> result=None created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:483> took 0.152 seconds
I have a Roborock S7 maxV and the sensors won’t be created. Only the vacuum and the camera is created. I already remove and start all over again but nothing change… I don’t see any errors on logs… is this vacuum compatible with this integration?
The app shows 8 m².
Response from get_status:
{'msg_ver': 2, 'msg_seq': 8995, 'state': 8, 'battery': 100, 'clean_time': 929, 'clean_area': 8087500, 'error_code': 0, 'map_present': 1, 'in_cleaning': 0, 'in_returning': 0, 'in_fresh_state': 1, 'lab_status': 3, 'water_box_status': 1, 'fan_power': 104, 'dnd_enabled': 1, 'map_status': 3, 'is_locating': 0, 'lock_status': 0, 'water_box_mode': 203, 'water_box_carriage_status': 0, 'mop_forbidden_enable': 0, 'adbumper_status': [0, 0, 0], 'water_shortage_status': 0, 'dock_type': 0, 'dust_collection_status': 0, 'auto_dust_collection': 1, 'mop_mode': 300, 'debug_mode': 0, 'dock_error_status': 0, 'unsave_map_reason': 0, 'unsave_map_flag': 0}
Hey,
It appears that it's also possible to sign-in to the Roborock cloud with just an email address (and a 2SV code), and without a password.
It's commented out in the original nodejs script for fetching the token+data from the Roborock cloud like so:
await loginApi.post('api/v1/sendEmailCode', new url.URLSearchParams({username: username, type: 'auth'}).toString()).then(res => res.data);
// ... get code from user ...
userdata = await loginApi.post('api/v1/loginWithCode', new url.URLSearchParams({username: username, verifycode: code, verifycodetype: 'AUTH_EMAIL_CODE'}).toString()).then(res => res.data.data);
Thought it could be a nice improvement over the current flow that requires a password.
Unexpected exception importing platform custom_components.roborock.vacuum
Traceback (most recent call last):
File "/Users/pi/.homeassistant-venv/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/Users/pi/.homeassistant-venv/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/Cellar/[email protected]/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/pi/.homeassistant/custom_components/roborock/vacuum.py", line 255, in <module>
class RoborockVacuum(RoborockCoordinatedEntity, StateVacuumEntity, ABC):
File "/Users/pi/.homeassistant/custom_components/roborock/vacuum.py", line 366, in RoborockVacuum
def capability_attributes(self) -> Mapping[str, Any] | None:
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType'
Unable to prepare setup for platform roborock.vacuum: Platform not found (Exception importing custom_components.roborock.vacuum).
Platform roborock does not generate unique IDs. ID _ogzWh1iWAK_n6kTEBFPog already exists - ignoring camera.upstairs_vacuum_2
Platform roborock does not generate unique IDs. ID is_water_box_carriage_attached__ogzWh1iWAK_n6kTEBFPog already exists - ignoring binary_sensor.upstairs_vacuum_mop_attached
Platform roborock does not generate unique IDs. ID is_water_box_attached__ogzWh1iWAK_n6kTEBFPog already exists - ignoring binary_sensor.upstairs_vacuum_water_box_attached
FAN_SPEEDS = {101: "Silent", 102: "Balanced", 103: "Turbo", 104: "Max"}
FAN_SPEEDS = {101: "Silent", 102: "Balanced", 103: "Turbo", 104: "Max", 105: "Gentle", 106: "Customize(Auto)"}
Thanks for all the great work. Everything is working fine.
I have a Roborock s6 maxV and would it be possible to see the stream from the front camera?
Hello.
I updated the program, I also updated the Roborock custom component.
After the update, the integration broke.
Logger: homeassistant.config_entries
Source: custom_components/roborock/api.py:165
Integration: Roborock (documentation, issues)
First occurred: 9:59:40 AM (3 occurrences)
Last logged: 10:09:39 AM
Error setting up entry Roborock S7 MaxV for roborock
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/roborock/init.py", line 30, in async_setup_entry
client = RoborockMqttClient(user_data, home_data)
File "/config/custom_components/roborock/api.py", line 165, in init
for device in home_data.get("devices") + home_data.get("receivedDevices"):
AttributeError: 'NoneType' object has no attribute 'get'
Receiving several of these when my vacuum was doing a segment cleaning (vacuum & mop) of two rooms. This is the S7 MaxV Ultra. I did open the app several times while it was cleaning but not sure if that's related to this. I'll have to pay closer attention next time to see if I can figure out when it's occurring. Log messages below with some entires leading up to the specific UnicodeDecodeErrors:
2022-12-31 03:54:38.489 DEBUG (MainThread) [custom_components.roborock.api.api] id=1614 Response from get_status: {'msg_ver': 2, 'msg_seq': 3070, 'state': 18, 'battery': 94, 'clean_time': 688, 'clean_area': 15505000, 'error_code': 0, 'map_present': 1, 'in_cleaning': 3, 'in_returning': 0, 'in_fresh_state': 0, 'lab_status': 1, 'water_box_status': 1, 'back_type': -1, 'wash_phase': 0, 'wash_ready': 0, 'fan_power': 102, 'dnd_enabled': 0, 'map_status': 3, 'is_locating': 0, 'lock_status': 0, 'water_box_mode': 203, 'water_box_carriage_status': 1, 'mop_forbidden_enable': 1, 'camera_status': 3457, 'is_exploring': 0, 'home_sec_status': 0, 'home_sec_enable_password': 0, 'adbumper_status': [0, 0, 0], 'water_shortage_status': 0, 'dock_type': 3, 'dust_collection_status': 0, 'auto_dust_collection': 1, 'avoid_count': 0, 'mop_mode': 300, 'debug_mode': 0, 'collision_avoid_status': 1, 'switch_map_mode': 0, 'dock_error_status': 0, 'charge_status': 1, 'unsave_map_reason': 0, 'unsave_map_flag': 0}
2022-12-31 03:54:38.490 DEBUG (MainThread) [custom_components.roborock.api.api] id=1615 Response from get_dnd_timer: {'start_hour': 22, 'start_minute': 0, 'end_hour': 7, 'end_minute': 0, 'enabled': 1}
2022-12-31 03:54:38.550 DEBUG (MainThread) [custom_components.roborock.api.api] id=1616 Response from get_clean_summary: {'clean_time': 71223, 'clean_area': 1105407500, 'clean_count': 29, 'dust_collection_count': 23, 'records': [1672284539, 1672018069, 1671833299, 1671762562, 1671735384, 1671649255, 1671636991, 1671562835, 1671476643, 1671399986, 1671305160, 1671158013, 1671142561, 1671043136, 1670986322, 1670957168, 1670723771, 1670711593, 1670511909, 1670511768]}
2022-12-31 03:54:38.551 DEBUG (MainThread) [custom_components.roborock.api.api] id=1617 Response from get_consumable: {'main_brush_work_time': 71223, 'side_brush_work_time': 71223, 'filter_work_time': 71223, 'filter_element_work_time': 0, 'sensor_dirty_time': 71223, 'strainer_work_times': 61, 'dust_collection_work_times': 23, 'cleaning_brush_work_times': 61}
2022-12-31 03:54:38.553 DEBUG (MainThread) [custom_components.roborock.api.api] id=1618 Requesting method get_clean_record with [1672284539]
2022-12-31 03:54:38.832 DEBUG (MainThread) [custom_components.roborock.api.api] id=1618 Response from get_clean_record: {'begin': 1672284539, 'end': 1672285908, 'duration': 1233, 'area': 20672500, 'error': 0, 'complete': 1, 'start_type': 2, 'clean_type': 3, 'finish_reason': 56, 'dust_collection_status': 1, 'avoid_count': 34, 'wash_count': 2, 'map_flag': 0}
2022-12-31 03:54:38.832 DEBUG (MainThread) [custom_components.roborock] Finished fetching roborock data in 0.513 seconds (success: True)
2022-12-31 03:54:39.710 ERROR (MainThread) [custom_components.roborock.api.api] 'utf-8' codec can't decode byte 0xe7 in position 8: invalid continuation byte
Traceback (most recent call last):
File "/config/custom_components/roborock/api/api.py", line 156, in on_message
if endpoint.decode().startswith(self._endpoint):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 8: invalid continuation byte
2022-12-31 03:54:55.647 DEBUG (MainThread) [custom_components.roborock.camera] Retrieving map from Roborock MQTT
2022-12-31 03:54:55.647 DEBUG (MainThread) [custom_components.roborock.api.api] id=1622 Requesting method get_map_v1 with None
2022-12-31 03:54:56.117 DEBUG (MainThread) [custom_components.roborock.api.api] id=1622 Response from get_map_v1: 634675 bytes
2022-12-31 03:54:57.268 DEBUG (MainThread) [custom_components.roborock.camera] Map data retrieved
2022-12-31 03:54:57.269 DEBUG (MainThread) [custom_components.roborock.camera] Map is ok
2022-12-31 03:54:57.284 WARNING (MainThread) [asyncio] Executing <Task finished name='Task-13496' coro=<VacuumCameraMap.async_update() done, defined at /config/custom_components/roborock/camera.py:161> result=None created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:515> took 1.168 seconds
2022-12-31 03:54:57.426 ERROR (MainThread) [custom_components.roborock.api.api] 'utf-8' codec can't decode byte 0xf8 in position 8: invalid start byte
Traceback (most recent call last):
File "/config/custom_components/roborock/api/api.py", line 156, in on_message
if endpoint.decode().startswith(self._endpoint):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 8: invalid start byte
2022-12-31 03:58:47.569 DEBUG (MainThread) [custom_components.roborock.api.api] Unknown data point number received 122 with 91
2022-12-31 03:58:50.880 DEBUG (MainThread) [custom_components.roborock.camera] Retrieving map from Roborock MQTT
2022-12-31 03:58:50.880 DEBUG (MainThread) [custom_components.roborock.api.api] id=1709 Requesting method get_map_v1 with None
2022-12-31 03:58:51.391 DEBUG (MainThread) [custom_components.roborock.api.api] id=1709 Response from get_map_v1: 635878 bytes
2022-12-31 03:58:52.582 DEBUG (MainThread) [custom_components.roborock.camera] Map data retrieved
2022-12-31 03:58:52.582 DEBUG (MainThread) [custom_components.roborock.camera] Map is ok
2022-12-31 03:58:52.598 WARNING (MainThread) [asyncio] Executing <Task finished name='Task-14284' coro=<VacuumCameraMap.async_update() done, defined at /config/custom_components/roborock/camera.py:161> result=None created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:515> took 1.207 seconds
2022-12-31 03:58:54.414 ERROR (MainThread) [custom_components.roborock.api.api] 'utf-8' codec can't decode byte 0xd4 in position 8: invalid continuation byte
Traceback (most recent call last):
File "/config/custom_components/roborock/api/api.py", line 156, in on_message
if endpoint.decode().startswith(self._endpoint):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd4 in position 8: invalid continuation byte
2022-12-31 04:03:00.987 DEBUG (MainThread) [custom_components.roborock.api.api] id=1799 Requesting method get_map_v1 with None
2022-12-31 04:03:01.449 DEBUG (MainThread) [custom_components.roborock.api.api] id=1799 Response from get_map_v1: 637128 bytes
2022-12-31 04:03:02.764 DEBUG (MainThread) [custom_components.roborock.camera] Map data retrieved
2022-12-31 04:03:02.764 DEBUG (MainThread) [custom_components.roborock.camera] Map is ok
2022-12-31 04:03:02.780 WARNING (MainThread) [asyncio] Executing <Task finished name='Task-15117' coro=<VacuumCameraMap.async_update() done, defined at /config/custom_components/roborock/camera.py:161> result=None created at /usr/local/python/lib/python3.10/site-packages/homeassistant/core.py:515> took 1.331 seconds
2022-12-31 04:03:05.090 ERROR (MainThread) [custom_components.roborock.api.api] 'utf-8' codec can't decode byte 0xc3 in position 8: invalid continuation byte
Traceback (most recent call last):
File "/config/custom_components/roborock/api/api.py", line 156, in on_message
if endpoint.decode().startswith(self._endpoint):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 8: invalid continuation byte
When selecting the Indiv.
option in the App the fan speed is null.
The option could be named different in the English verison. It is the last tab in the menu opened by the button in the lower right of the map screen.
This could be correct, as the speed would probably change per room.
Given, that the API is providing this information, this would require some kind of indication maybe by an additional attribute like fan_speed_individual: true
.
Entity:
fan_speed_list:
- Silent
- Balanced
- Turbo
- Max
battery_level: 89
battery_icon: mdi:battery-90
fan_speed: null
icon: mdi:robot-vacuum
friendly_name: Fussel
supported_features: 16383
Roborock S7
Hi!
I have just come across this. Amazing! I can finally use the Roborock app (for advanced features) and still use HomeAssistant. So thank you very much for this!
I was just wondering whether the API for Roborock and Mi Home are too different for it to be possible to merge the efforts of this integration with the Xiaomi one? Considering when I switched between the Roborock app and the Mi Home app, my robot's maps were still there, so I am curious if they might be using the exact same (or very similar) backend, just with different endpoints and authentication methods?
This might make it easier to maintain the integration in the future when developments made for the Roborock API could be joined with the Xiaomi Integration. So they would benefit from each other.
I’ve noticed the state hardly gets updated. It does if you reload the integration and if you use the vacuum in the first hour or so after reloading. I’ve always chucked it up to starting the cleaning cycle from the Roborock app. But this morning my HA automation started the cleaning cycle for the first time. It had a connection as it did start the cleaning cycle but the state never updated, it said it was charging while the vacuum was running. Additionally the history didn’t record the cycle either, which is to be expected as the state never changed.
Anyone else seeing this too?
Could someone make it possible to configure the map rotation via the integration configuration UI? I can already change the rotation by altering CONF_ROTATE: 0
in the code, so the underlying logic is already there - it just needs to be exposed as a configuration.
Hi, before updating top 0.0.1 everything worked fine so far. Now I got an error and the integration is broken.
Logger: homeassistant.config_entries
Source: custom_components/roborock/api.py:165
Integration: Roborock (documentation, issues)
First occurred: 16:41:08 (1 occurrences)
Last logged: 16:41:08
Error setting up entry Roborock S7 MaxV for roborock
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/roborock/init.py", line 30, in async_setup_entry
client = RoborockMqttClient(user_data, home_data)
File "/config/custom_components/roborock/api.py", line 165, in init
for device in home_data.get("devices") + home_data.get("receivedDevices"):
AttributeError: 'NoneType' object has no attribute 'get'
Hi,
not sure if I missed it, but it would be cool to have a list of features and robots that are currently supported in the readme - especially compared to the original xiaomi ha integration.
I have a 6 MaxV and wonder if I can use the integration to replace the xiaomi integration.
I am using:
Is it possible to send this command for cleaning a list of rooms via this integration?
{"command":"app_segment_clean","params":[..room ids..]}
I think it would be cool if the Github Discussion feature could be enabled, so we could share information/custom cards etc there without having the information spread around various Issues.
Hello,
I was just trying to setup my Roborock S6 but I'm getting the following error:
just wondering if S6 is not supported or there's something wrong with my account.
Only debug message I'm receiving is:
2022-12-15 11:51:03.980 DEBUG (MainThread) [custom_components.roborock.config_flow] Starting a scan for Roborock devices
cheers
Thanks for the awesome work ! It is great to see how quickly this integration is evolving!
When I send the load_multi_map command with the vacuum.send_command service call to change to a different floor map, the new map is immediately loaded in the app and also the attribute map_status in home assistant changes after a while representing the floor I loaded, but the actual map entity is not refreshed. Only when I start cleaning does it update.
Would it be possible to force a map entity refresh after a load_multi_map service call? Or whenever map_status has changed?
The reported sensor data in HA does not align at all with the values from the app. "Main brush left", "filter left", "side brush left" report all the same value - which does not appear to match anything in the app. Also the "filter_left" value is wrong, although different from the other values.
On v0.0.1 the robot entity is not updating after it was idle for some time.
Reload of the integration fixes the issue.
Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[55].data.user_data=<custom_components.roborock.api.containers.UserData object at 0x7ff586513bb0>(<class 'custom_components.roborock.api.containers.UserData'>
09:27:42 – (ERROR) helpers/storage.py - message first occurred at 09:27:36 and shows up 2 times
Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[55].data.user_data=<custom_components.roborock.api.containers.UserData object at 0x7ff586513bb0>(<class 'custom_components.roborock.api.containers.UserData'>
09:27:42 – (ERROR) util/json.py - message first occurred at 09:27:36 and shows up 2 times
Unexpected error fetching roborock data: 'int' object has no attribute 'get'
09:27:37 – (ERROR) Roborock (custom integration) - message first occurred at 09:19:27 and shows up 13 times
Roborock mqtt client disconnected (rc: 7)
09:27:36 – (ERROR) Roborock (custom integration) - message first occurred at 09:19:37 and shows up 12 times
Error setting up entry Roborock for roborock
09:27:35 – (ERROR) Roborock (custom integration)
Hi,
can this be used to just get the token and use it for example for the homebridge plugin?
Thanks so much for this, I've been waiting for a Roborock API implementation for HA for so long! Awesome work so far!
BTW, I posted about this project here, plenty of other people are excited too:
https://old.reddit.com/r/homeassistant/comments/zg5cvm/the_roborock_app_is_finally_supported_no_need_for/
That said, here is this projects' first bug report ;)
When I turn on/off my S7 MaxV I get this error:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/roborock/api.py:168
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 19:49:45 (1 occurrences)
Last logged: 19:49:45
[140638002292688] EOF occurred in violation of protocol (_ssl.c:2396)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 358, in async_turn_on
await self.hass.async_add_executor_job(partial(self.turn_on, **kwargs))
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/roborock/vacuum.py", line 79, in turn_on
self._client.send_request(self._device.get('duid'), "app_start", [], True)
File "/config/custom_components/roborock/api.py", line 296, in send_request
self._mqtt_client.send_request(device_id, method, params, secure)
File "/config/custom_components/roborock/api.py", line 194, in send_request
self.send_msg_raw(device_id, 101, timestamp, payload)
File "/config/custom_components/roborock/api.py", line 168, in send_msg_raw
info = self.client.publish(
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1257, in publish
rc = self._send_publish(
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 2693, in _send_publish
return self._packet_queue(PUBLISH, packet, mid, qos, info)
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3016, in _packet_queue
return self.loop_write()
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1577, in loop_write
rc = self._packet_write()
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 2464, in _packet_write
write_length = self._sock_send(
File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 649, in _sock_send
return self._sock.send(buf)
File "/usr/local/lib/python3.10/ssl.py", line 1206, in send
return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396)
It appears the DnD start and DnD end sensors are showing up in their native value (UTC) in the Home Assistant GUI. I thought the expected behavior is it would automatically be converted to the user's time zone set in HA.
Tried looking into this one but couldn't quite figure it out before heading to bed. With device_class
of timestamp
being used, native_value
should "return a Python datetime.datetime object, with time zone information" (HA dev docs), which appears to be the case. I'm not sure if this is maybe an issue on the HA side?
I'd love to be able to vacuum the kitchen using a button press from my dashboard. Do you have an idea of how I'd start to integrate that (or what i'd need to update in this codebase?)
thanks,
Graham
I get the error message "Error calling the service vacuum/vacuum_clean_segment. Service not found." no matter the vacuum platform I use. Sadly no other error message.
I am using the lovelace xiaomi vacuum card.
Upgrading from 0.0.3 to 0.0.6 made the robot and camera unavailable. The new sensors seem to work.
Model: a27
Location: EU
Traceback (most recent call last):
File "/config/custom_components/roborock/api.py", line 220, in on_message
decrypted = unpad(decipher.decrypt(data.get("payload")[24:]), AES.block_size)
File "/usr/local/lib/python3.10/site-packages/Crypto/Util/Padding.py", line 92, in unpad
raise ValueError("Padding is incorrect.")
ValueError: Padding is incorrect.
I have two vacuums on my Roborock account. I noticed the integration was created only for one of them (the first from the list).
Logger: homeassistant.loader
Source: custom_components/roborock/vacuum.py:66
Integration: Roborock ([documentation](https://github.com/humbertogontijo/homeassistant-roborock), [issues](https://github.com/humbertogontijo/homeassistant-roborock/issues))
Unexpected exception importing platform custom_components.roborock.vacuum
Traceback (most recent call last):
File "/Users/pi/.homeassistant-venv/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/Users/pi/.homeassistant-venv/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/Cellar/[email protected]/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/pi/.homeassistant/custom_components/roborock/vacuum.py", line 55, in <module>
class RoborockVacuum(StateVacuumEntity):
File "/Users/pi/.homeassistant/custom_components/roborock/vacuum.py", line 66, in RoborockVacuum
def send(self, command: str, params: list | None = None):
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Logger: homeassistant.setup
Source: setup.py:338
Unable to prepare setup for platform roborock.vacuum: Platform not found (Exception importing custom_components.roborock.vacuum).
Everything is latest
Home Assistant 2022.12.0
Frontend 20221207.0 - latest
I am using HomeAssistant Core at macOS, the Python is 3.9.15, also I updated to 6eef389
for this component before seeing this error.
Hi,
first of all, you are my savior! Hammer awesome that you got the integration done, I've been waiting forever!
Do you mean the sensors to the filter etc. you get also still?
Do you have an overview of what the numbers behind the attributes mean?
For example at water_box_status or water_box_carriage_status. Currently, I have a 1, which means that the water tank is good. And if there is 0 then it should be filled, do I understand that correctly?
I want to create the sensors individually via templates.
Thank you!
Thx for this component!!! Unfortunately I got an error when setup the integration. The credentials are correct (I got a message in the Roborock app that someone logged in from antoher device). These are the errors from the log.
Logger: homeassistant.setup
Source: setup.py:338
First occurred: 09:20:49 (1 occurrences)
Last logged: 09:20:49
Unable to prepare setup for platform roborock.vacuum: Platform not found (Exception importing custom_components.roborock.vacuum).
Logger: homeassistant.loader
Source: custom_components/roborock/vacuum.py:68
Integration: Roborock (documentation, issues)
First occurred: 09:20:49 (1 occurrences)
Last logged: 09:20:49
Unexpected exception importing platform custom_components.roborock.vacuum
Traceback (most recent call last):
File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/home/homeassistant/.pyenv/versions/3.9.9/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/mnt/dietpi_userdata/homeassistant/custom_components/roborock/vacuum.py", line 56, in
class RoborockVacuum(StateVacuumEntity):
File "/mnt/dietpi_userdata/homeassistant/custom_components/roborock/vacuum.py", line 68, in RoborockVacuum
def send(self, command: str, params: list[Any] | None = None):
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
Regards,
Bernd
Hello~
Thanks for making it.
It is set to include the map.
It doesn't seem to provide a map.
Just installed the intergration, logged in and i can see in the logs that it fails with:
[31m2022-12-09 11:26:03.873 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up roborock platform for vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.gather(*pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 605, in _async_add_entity capabilities=entity.capability_attributes, File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 213, in capability_attributes if self.supported_features & VacuumEntityFeature.FAN_SPEED: File "/config/custom_components/roborock/vacuum.py", line 100, in supported_features return VacuumEntityFeature(features) File "/usr/local/lib/python3.10/enum.py", line 385, in __call__ return cls.__new__(cls, value) File "/usr/local/lib/python3.10/enum.py", line 710, in __new__ raise ve_exc ValueError: 16383 is not a valid VacuumEntityFeature�[0m
Im from EU, using Roborock S7
Getting the below errors when trying to set it up for the first time. Using the latest version 0.0.9:
Logger: homeassistant.helpers.storage
Source: helpers/storage.py:254
First occurred: 09:35:47 (1 occurrences)
Last logged: 09:35:47
Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[33].data.user_data=<custom_components.roborock.api.containers.UserData object at 0xffff606fc430>(<class 'custom_components.roborock.api.containers.UserData'>
Logger: homeassistant.util.json
Source: util/json.py:88
First occurred: 09:35:47 (1 occurrences)
Last logged: 09:35:47
Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[33].data.user_data=<custom_components.roborock.api.containers.UserData object at 0xffff606fc430>(<class 'custom_components.roborock.api.containers.UserData'>
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/roborock/api/containers.py:284
Integration: Roborock (documentation, issues)
First occurred: 09:35:46 (1 occurrences)
Last logged: 09:35:46
Error setting up entry Roborock for roborock
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/roborock/__init__.py", line 32, in async_setup_entry
home_data = HomeData(await api_client.get_home_data(user_data))
File "/config/custom_components/roborock/api/api.py", line 392, in get_home_data
rriot = user_data.rriot
File "/config/custom_components/roborock/api/containers.py", line 284, in rriot
return RRiot(self.data.get(UserDataField.RRIOT))
AttributeError: 'UserData' object has no attribute 'get'
Thanks for everyone on the development of this project. I've been here since the initial commit and everything has worked great (Haven't experienced any bugs)
I updated to v0.06 today and had some issues. I removed the integration completely, and re-added.
When I signed back into Roborock only 1 out of the two devices were detected. It's missing my Roborock S7 MaxV Ultra.
Any ideas?
hi, thx for component
can add support region (https://aapks.com/apk/roborock/version/53334861/) ?
cniot.roborock.com
euiot.roborock.com
ruiot.roborock.com
usiot.roborock.com
My logs are filled with the following error in addition to #21:
Logger: homeassistant
Source: custom_components/roborock/vacuum.py:130
Integration: Roborock (documentation, issues)
First occurred: 03:38:56 (625 occurrences)
Last logged: 10:38:38
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 813, in _update_entity_states
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/config/custom_components/roborock/vacuum.py", line 125, in state
return self.status
File "/config/custom_components/roborock/vacuum.py", line 130, in status
return STATE_CODE_TO_STRING.get(self._status.get("state"))
AttributeError: 'str' object has no attribute 'get'
Sometimes the map view just displays a blue background with the text "OK" in the middle of it.
Here's the log:
2022-12-14 17:37:45.363 WARNING (MainThread) [homeassistant.components.camera] Updating roborock camera took longer than the scheduled update interval 0:00:05
2022-12-14 17:37:45.365 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.roborock_s7_maxv is taking over 10 seconds
2022-12-14 17:37:45.367 ERROR (SyncWorker_2) [custom_components.roborock.camera] string index out of range
Traceback (most recent call last):
File "/config/custom_components/roborock/camera.py", line 183, in update
self._handle_map_data()
File "/config/custom_components/roborock/camera.py", line 239, in _handle_map_data
map_data, map_stored = self.get_map(
File "/config/custom_components/roborock/camera.py", line 216, in get_map
map_data = self.decode_map(
File "/config/custom_components/roborock/camera.py", line 232, in decode_map
return MapDataParserRoborock.parse(
File "/config/custom_components/roborock/common/map_data_parser.py", line 87, in parse
map_header_length = MapDataParserRoborock.get_int16(raw, 0x02)
File "/config/custom_components/roborock/common/map_data_parser.py", line 312, in get_int16
((data[address + 0] << 0) & 0xFF) | \
IndexError: string index out of range
I think there is a state_code missing.
HA displays the state as 'charging' while the roborock displays a 'charged' state.
Looking at the code (I'm a novice) I've found the state_codes and is doesn't have a code for 'charged'. I did a quick google search but couldn't find Roborock's status codes. If you can direct me to some documentation, I'd happily create a PR.
Looking through my HA logs after the integration has been running for several hours, I noticed there's cases where the "API" didn't return a value so None
was sent to the sensor and the lambda function for parse_datetime_time
is failing.
I noticed a check was added to catch this but I think if native_value
is None
in this case, won't _handle_coordinator_update
just return None
(python default)? I'm wondering if we need an else
statement for certain sensors (time related) to return the previous value, or do we modify the lambda function to just check for None
types and display Unknown for the device state.
Also, I'm wondering if it would be better to catch these on the "API" side so the integration doesn't have to worry about the catching these errors?
2022-12-30 11:44:48.373 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved: File "/usr/local/python/bin/hass", line 8, in <module>
sys.exit(main())
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/__main__.py", line 202, in main
exit_code = runner.run(runtime_conf)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/runner.py", line 120, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 628, in run_until_complete
self.run_forever()
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 595, in run_forever
self._run_once()
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 1873, in _run_once
handle._run()
File "/usr/local/python/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/event.py", line 1326, in run_action
hass.async_run_hass_job(job, utc_point_in_time)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/core.py", line 580, in async_run_hass_job
return self.async_add_hass_job(hassjob, *args)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/core.py", line 483, in async_add_hass_job
task = self.loop.create_task(hassjob.target(*args))
Traceback (most recent call last):
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
self.async_update_listeners()
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
update_callback()
File "/config/custom_components/roborock/sensor.py", line 268, in _handle_coordinator_update
native_value = self._determine_native_value()
File "/config/custom_components/roborock/sensor.py", line 291, in _determine_native_value
native_value = self.entity_description.value(native_value)
File "/config/custom_components/roborock/sensor.py", line 61, in <lambda>
value=lambda values: parse_datetime_time(time(hour=values[0], minute=values[1])),
TypeError: 'NoneType' object cannot be interpreted as an integer
2022-12-30 12:43:28.370 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved: File "/usr/local/python/bin/hass", line 8, in <module>
sys.exit(main())
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/__main__.py", line 202, in main
exit_code = runner.run(runtime_conf)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/runner.py", line 120, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 628, in run_until_complete
self.run_forever()
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 595, in run_forever
self._run_once()
File "/usr/local/python/lib/python3.10/asyncio/base_events.py", line 1873, in _run_once
handle._run()
File "/usr/local/python/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/event.py", line 1326, in run_action
hass.async_run_hass_job(job, utc_point_in_time)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/core.py", line 580, in async_run_hass_job
return self.async_add_hass_job(hassjob, *args)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/core.py", line 483, in async_add_hass_job
task = self.loop.create_task(hassjob.target(*args))
Traceback (most recent call last):
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
self.async_update_listeners()
File "/usr/local/python/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
update_callback()
File "/config/custom_components/roborock/sensor.py", line 268, in _handle_coordinator_update
native_value = self._determine_native_value()
File "/config/custom_components/roborock/sensor.py", line 291, in _determine_native_value
native_value = self.entity_description.value(native_value)
File "/config/custom_components/roborock/sensor.py", line 61, in <lambda>
value=lambda values: parse_datetime_time(time(hour=values[0], minute=values[1])),
TypeError: 'NoneType' object cannot be interpreted as an integer
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.