Closed bkueppers closed 7 months ago
Oh, just forgot: Valetudo mapper (https://github.com/rand256/valetudo-mapper) works, but does not give me the rooms (which is what I should expect from what I understand about that tool...)
@bkueppers thanks for the report. I'm currently working to correct some functions. The log is showing the map data (binary format) that I forgot to remove before. The room should be configured in the vacuum. I use an S5 too to test the camera extracted the rooms. I will check the logs you provided and try to get back you as soon.
@bkueppers in your logs there should be:
rockrobo: Received vacuum destinations: {"spots":[],"zones":[],"rooms":[{"name":"#1","id":1},{"name":"#16","id":16},{"name":"#17","id":17},{"name":"#18","id":18},{"name":"#2","id":2}],"updated":1712048518418}
Then the rooms should be display. I will try to release a new version tomorrow, hopefully the issue with the errors you provided should be gone by then ;) Is the map display?
In which log would I find that?
No, the map is not drawn. Only a grey picture is displayed.
In which log would I find that?
No, the map is not drawn. Only a grey picture is displayed.
@bkueppers probably I found the issue.. please check if the auto zoom is enable, if so there is an issue with the cropping data that also in my test generate the grey map.
@bkueppers I found the problem in the connector.py I will soon release the version that should fix this issue.
Thank you very much, being able to use your camera with support for the rooms is a considerable improvement for my setup :-)
@bkueppers when it will work, please consider to start this project it helps really a lot me :)
@bkueppers I'm reopening this as it was closed automatically, as soon you can install the 2024.04.0 that was just release, please confirm if it works for you.
Sadly, it still does not work for me. I've purged the integration and completely re-installed it, but still I get the error with index out of range.
Traceback (most recent call last):
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 458, in get_image_from_rrm
self.room_propriety = await self.get_rooms_attributes(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 615, in get_rooms_attributes
self.room_propriety = self.extract_room_properties(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 269, in extract_room_properties
coordinates[0].pop()
~~~~~~~~~~~^^^
IndexError: list index out of range
Anything that I can help with to fix this error? Provide specific information, e.g.?
By the way: How should look the MQTT topic? Which messages are you parsing there?
@bkueppers the topic is _mapdata, same as it is done on the original rand256 app but in python. To get the rooms I use the destinations topic that is published after the getdestinations command is send to the vacuum (this is done internally in the connector.py as soon the first image is received). But the coordinates_ are calculated based on the segment data (pixels) in the image data (_mapdata).
I noticed that the vacuum with rand256 miss the topic $state and this is creating sometime issues with the rendering because the internal mqtt of home assistant (requirments), so if the vacuum isn't publishing the map_data topic this could be the issue (start / stop the vacuum should solve it). vacuum logs:
2024-04-03T11:24:41.152Z Timesync packet received
2024-04-03T10:54:41.152Z Timesync packet received
2024-04-03T10:54:39.889Z Connected successfully to mqtt server
2024-04-03T10:54:39.426Z Closed connection to mqtt server
2024-04-03T10:24:41.152Z Timesync packet received
2024-04-03T09:54:41.152Z Timesync packet received
2024-04-03T09:24:41.152Z Timesync packet received
2024-04-03T08:54:41.152Z Timesync packet received
2024-04-03T08:24:41.152Z Timesync packet received
2024-04-03T07:54:41.152Z Timesync packet received
2024-04-03T07:29:59.294Z MQTT Error : update_map_data_topic : mqtt updateMapDataTopic timed out
2024-04-03T07:24:41.152Z Timesync packet received
2024-04-03T06:54:41.152Z Timesync packet received
2024-04-03T06:24:41.152Z Timesync packet received
2024-04-03T05:54:41.152Z Timesync packet received
2024-04-03T05:24:41.153Z Timesync packet received
2024-04-03T04:54:41.152Z Timesync packet received
2024-04-03T04:24:41.152Z Timesync packet received
2024-04-03T03:54:41.152Z Timesync packet received
2024-04-03T03:24:41.153Z Timesync packet received
2024-04-03T02:54:41.153Z Timesync packet received
2024-04-03T02:24:41.153Z Timesync packet received
2024-04-03T01:54:41.154Z Timesync packet received
2024-04-03T01:24:41.634Z Connected successfully to mqtt server
2024-04-03T01:24:40.494Z Probed last id = 1001 using get_status (64 retries)
2024-04-03T01:24:40.359Z Timesync packet received
2024-04-03T01:24:40.353Z Robot connected
2024-04-03T01:24:30.483Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2024-04-03T01:24:14.997Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2024-04-03T01:23:59.209Z Webserver is running on port 80 (http)
2024-04-03T01:23:59.204Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053
2024-04-03T01:23:59.128Z No ssl key found. Expected path: /mnt/data/valetudo/key.pem
2024-04-03T01:23:59.127Z No ssl cert found. Expected path: /mnt/data/valetudo/cert.pem
2024-04-03T01:23:58.939Z timesync: ntpd: setting time to 2024-04-03 03:23:58.903460 (offset -107.435667s)
2024-04-03T01:25:44.130Z Loading configuration file: /mnt/data/valetudo/config.json
By the way this is my vacuum: Can you please enable the debug logs of the camera and check when HA is logging when the vacuum is detected as connected in mqtt?
@bkueppers probably this can be the issue in your case:
for zone in zones_data:
zone_name = zone.get("name")
coordinates = zone.get("coordinates")
coordinates[0].pop()
x1, y1, x2, y2 = coordinates[0]
if coordinates:
zone_properties[zone_name] = {
"zones": coordinates,
"name": zone_name,
"x": ((x1 + x2) // 2),
"y": ((y1 + y2) // 2),
}
id_count += 1
id_count = 1
for point in points_data:
point_name = point.get("name")
coordinates = point.get("coordinates")
x1, y1 = coordinates
if coordinates:
point_properties[id_count] = {
"position": coordinates,
"name": point_name,
"x": x1,
"y": y1,
}
id_count += 1
line 266 to 291 in valetudo/rand256/image_handler.py if you will provide the camera logs I can check and eventually correct it. You can temporally delete those lines if you feel confident to do it to test if this solve the issue. Somehow the json data are translated else there should be an error on the parser, it looks that "destinations" topic anyhow isn't including the zones or points.
I will test later if commenting out the lines will fix the thing.
Maybe a stupid question: If I enabled debug logging, how Do I actually access the log file? Because the log viewer does not seem to give me everything,...
@bkueppers https://github.com/sca075/valetudo_vacuum_camera/blob/main/docs/snapshots.md this is explaining how to get the logs. If you use the camera export it should come out the log from home assistant, the json when extracted and raw data from mqtt, all will be in zip archive in www, when you export the logs from the camera options.
Will take care of the later, for the moment I was able to retrieve the following logs, maybe they already help you:
2024-04-03 13:32:23.233 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] Camera roborock_1 Starting up..
2024-04-03 13:32:23.233 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] System Release: homeassistant, 6.1.73-haos-raspi
2024-04-03 13:32:23.234 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] System Version: #1 SMP PREEMPT Wed Mar 13 12:10:55 UTC 2024
2024-04-03 13:32:23.234 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] System Machine: aarch64
2024-04-03 13:32:23.234 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] Python Version: 3.12.2
2024-04-03 13:32:23.247 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] Memory Available: 2651.7 and In Use: 1072.6
2024-04-03 13:32:23.248 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1 not ready, not connected to MQTT.
2024-04-03 13:32:23.263 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1 not ready, not connected to MQTT.
2024-04-03 13:32:23.368 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] Received roborock_1 image data from MQTT
2024-04-03 13:32:23.369 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] Do it once.. request destinations to: valetudo/roborock_1
2024-04-03 13:32:23.370 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Received vacuum docked status and battery level: 100%.
2024-04-03 13:32:23.376 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Received vacuum destinations: {"spots":[],"zones":[{"name":"Küche","coordinates":[]}],"rooms":[{"name":"#1","id":1},{"name":"#2","id":2},{"name":"Flur","id":19},{"name":"Küche","id":18},{"name":"Treppenhaus","id":17},{"name":"Wohnzimmer","id":20}],"updated":1712143887288}
2024-04-03 13:32:23.423 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Received vacuum destinations: {"spots":[],"zones":[{"name":"Küche","coordinates":[]}],"rooms":[{"name":"#1","id":1},{"name":"#2","id":2},{"name":"Flur","id":19},{"name":"Küche","id":18},{"name":"Treppenhaus","id":17},{"name":"Wohnzimmer","id":20}],"updated":1712143943044}
2024-04-03 13:32:23.424 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Received vacuum destinations: {"spots":[],"zones":[{"name":"Küche","coordinates":[]}],"rooms":[{"name":"#1","id":1},{"name":"#2","id":2},{"name":"Flur","id":19},{"name":"Küche","id":18},{"name":"Treppenhaus","id":17},{"name":"Wohnzimmer","id":20}],"updated":1712143943044}
2024-04-03 13:32:23.424 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Received vacuum destinations: {"spots":[],"zones":[{"name":"Küche","coordinates":[]}],"rooms":[{"name":"#1","id":1},{"name":"#2","id":2},{"name":"Flur","id":19},{"name":"Küche","id":18},{"name":"Treppenhaus","id":17},{"name":"Wohnzimmer","id":20}],"updated":1712143943044}
2024-04-03 13:32:26.273 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1: Camera image data update available: True
2024-04-03 13:32:26.273 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Processing Rand256 data from MQTT.
2024-04-03 13:32:26.510 INFO (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] roborock_1: Extraction of Rand256 JSON Complete.
2024-04-03 13:32:26.513 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1:Composing the image for the camera.
2024-04-03 13:32:26.514 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] Vacuum Data ID: f2481485-5f50-484e-b854-e7e798047e2e
2024-04-03 13:32:26.536 DEBUG (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] robot position: [2556, 2586], robot angle: 550
2024-04-03 13:32:26.536 DEBUG (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] charger position: [2554, 2604]
2024-04-03 13:32:26.536 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1: Empty image with background color
2024-04-03 13:32:27.173 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1: Overlapping Layers
2024-04-03 13:32:27.509 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1: Completed floor Layers
2024-04-03 13:32:27.566 INFO (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1: Completed base Layers
2024-04-03 13:32:27.566 DEBUG (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] Checking for rooms data..
2024-04-03 13:32:28.251 WARNING (roborock_1_camera_0) [custom_components.valetudo_vacuum_camera.valetudo.rand256.image_handler] roborock_1 : Error in get_image_from_json: list index out of range
Traceback (most recent call last):
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 458, in get_image_from_rrm
self.room_propriety = await self.get_rooms_attributes(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 615, in get_rooms_attributes
self.room_propriety = self.extract_room_properties(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/valetudo_vacuum_camera/valetudo/rand256/image_handler.py", line 269, in extract_room_properties
coordinates[0].pop()
~~~~~~~~~~~^^^
IndexError: list index out of range
2024-04-03 13:32:28.303 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera_processing] roborock_1: Camera frame processed.
2024-04-03 13:32:28.304 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1: Output Gray Image.
2024-04-03 13:32:28.304 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] Searching for /config/.storage/valetudo_camera/roborock_1.png.
2024-04-03 13:32:28.308 INFO (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1: Returning Empty image.
2024-04-03 13:32:28.353 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1: Image update complete
2024-04-03 13:32:28.353 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] Adjusted roborock_1: Frame interval: 2.086
2024-04-03 13:32:28.367 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1 System CPU usage stat: 2.9%
2024-04-03 13:32:28.369 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.camera] roborock_1 Camera Memory usage in GB: 0.43, 11.51% of Total.
2024-04-03 13:35:40.219 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.valetudo.MQTT.connector] Unsubscribing topics!!!
@bkueppers okay I found the problem.. this is happening because there are actually no coordinates on the zones. Received vacuum destinations: {"spots":[],"zones":[{"name":"Küche","coordinates":[]}]...} If you edit the zone Küche in the robot or remove it...
then the camera should load correctly. Please give it a try and let me know if it works ;) Of course at his point I keep this open till the next release to fix this potential issue. Thanks a lot for the help understanding were was the problem, really appreciated. Have a nice evening.
Indeed, removing the zone without coordinates fixed the problem. Thanks a lot! :-)
Fix will be released on 2024.04.1 the next week. I just changed the code to avoid when the coordinates are an empty list.
ccess_token: 905425d8b0ed68273d6dd29ceaa16797d9f1b521f6a6e4c32f5fb849ae244385
model_name: Valetudo Vacuums
brand: Valetudo Vacuum Camera
friendly_name: vacuum Camera
vacuum_battery: 100%
vacuum_position:
x: 25650
'y': 25800
angle: 536
in_room: '#16'
vacuum_topic: valetudo/rockrobo
vacuum_status: docked
json_data: Success
vacuum_json_id: 56bbf2ee-b11f-4a08-b912-4f9d8ef014ce
calibration_points:
- vacuum:
x: 33020
'y': 28340
map:
x: 0
'y': 0
- vacuum:
x: 13820
'y': 28340
map:
x: 1594
'y': 0
- vacuum:
x: 13820
'y': 17750
map:
x: 1594
'y': 896
- vacuum:
x: 33020
'y': 17750
map:
x: 0
'y': 896
snapshot: false
snapshot_path: /local/snapshot_rockrobo.png
entity_picture: /api/camera_proxy/camera.vacuum_camera?token=905425d8b0ed68273d6dd29ceaa16797d9f1b521f6a6e4c32f5fb849ae244385
supported_features: 1
rooms:
'1':
number: 1
outline:
- - 22100
- 27250
- - 17650
- 27250
- - 17650
- 24150
- - 22100
- 24150
name: '#1'
x: 19875
'y': 25700
'2':
number: 2
outline:
- - 27250
- 23050
- - 24950
- 23050
- - 24950
- 21950
- - 27250
- 21950
name: '#2'
x: 26100
'y': 22500
'16':
number: 16
outline:
- - 27950
- 27200
- - 22250
- 27200
- - 22250
- 23100
- - 27950
- 23100
name: '#16'
x: 25100
'y': 25150
'17':
number: 17
outline:
- - 22200
- 24500
- - 20550
- 24500
- - 20550
- 21700
- - 22200
- 21700
name: '#17'
x: 21375
'y': 23100
'18':
number: 18
outline:
- - 23500
- 23500
- - 21700
- 23500
- - 21700
- 21550
- - 23500
- 21550
name: '#18'
x: 22600
'y': 22525
zones:
test:
zones:
- - 24000
- 24000
- 25058
- 24787
name: test
x: 24529
'y': 24393
vacuum destinations: {"spots":[],"zones":[{"name":"kitchen","coordinates":[]},{"name":"test","coordinates":[[24000,24000,25058,24787,1]]}] The kitchen coordinates will be then skipped. If you will start this project will be really appriciated.
Checklist
The problem
The integration is apparently not able to parse the map data sent out over MQTT. In the logs I find this:
There is mapdata coming in over MQTT at topic valetudo/roborock_1/map_data, but it does not seem to be JSON:
What version of an integration has described problem?
v1.6.0
What was the last working version of an integration?
--
What vacuum model do you have problems with?
Roborock.V2 (S5)
Please firmware installed on your Vacuum.
002034 (MiIO) / v0.10.10 (valetudo RE)
What type of platform you use?
ARM (Raspberry Pi, Odroid, etc.) > 4GB
What version of Home Assistant do you use?
2024.3.3
What type of installation are you running?
Home Assistant OS
Camera's settings.
No response
Logs or Errors shown in the HA snapshots (please enable the Debug Mode)
No response
Additional information
No response