Valetudo Vacuums Map Camera for Home Assistant

@Gmherr2 what firmware rand256 or Hypfer? I do test it on a PI4 and it rendered both without huge delay, I noticed this phenomena on the rand256 rendering, and honesty I’m working on it, I might found a solution on the next version anyhow please confirm the vacuum firmware you use.

  • edit:
    I mean “similar issue” is not the UI froze or become unresponsive, on PI4 and the standard server the rand256 vacuum disappears for a few sec and but this do not impact Home Assistant performances.

In any cases thanks for reporting your experience I will improve the code with some “safe guards”.

In general 8G bites memory and whatever CPU it should work and memory wise is well under the limits imposed from HA OS normally. There is in the logs of the camera the possibility to check the frame rate (that at this moment is automatically calculated)

I am using Hypfer firmware on a Roborock S7. My Home Assistant instance is installed through Proxmox and is running on an HP T620 ThinClient, it has 16 GB of ram so should be fine. I didn’t notice a spike on the CPU when this issue was occurring, I’ll do some more investigation on my side.

Yes please let me know the result of your investigation as per this will help me to improve the code. can you please eventually open an issue on the repository so that will be much easier to keep track, thanks a lot in advance:)

I didn’t test this configuration honestly yet… this is a good catch :slight_smile:

@fonix232 v.1.5.0 is now out and this version is now supporting the auto trims as you proposed, thanks a lot for it :slight_smile:
@Gmherr2 Added some new safe guard, as I wrote earlier to you… there is something strange when HA updates are available on the supervised version that I guess is the same you are using, anyhow it is possible now also to get the CPU and memory usage from the camera logs, and as well I made sure that we process one message per frame. If doesn’t work for you there is alway a nice alternative as on the beginning of the page.
@ all the rest hope you will enjoy the new menus and simplified options :wink:

Brilliant work! I’ll be testing it out soon.

Edit 1:

Okay, so far it seems to work okay… Except I’m now unable to configure colours. If I configure just the colours without transparency, I get an “Unknown error”, with the following logs:

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 11:57:19 (3 occurrences)
Last logged: 11:57:36

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 234, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/config_flow.py", line 554, in async_step_base_colours
    return await self.async_step_opt_save()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/config_flow.py", line 700, in async_step_opt_save
    opt_update = await update_options(self.bk_options, self.options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/common.py", line 104, in update_options
    updated_options[key] = bk_options[key]
                           ~~~~~~~~~~^^^^^
KeyError: 'enable_www_snapshots'

If I try to set transparency, it jumps back to the colour config panel, without saving any info.

I re-created the integration entry from scratch so the old config should not be an issue.

Well thanks also for the report on GitHub… 1.5.2-Alpha is out… as you know 1.5.2 fix this issue as well.

Merry Christmas and Happy New Year to All of you… and thanks a lot to all of you, for your continues support on improving this component… your ideas an proposals… this year was really a lot of fun and I’m glad that the camera is improving each days… because of you guys supporting this development and highlighting issues or improvements to do.

Hope you will enjoy this time with your Families more than other… to the next year :wink:

@Gmherr2,

First of all, best wishes for the new year coming. I made quite a modification of the render and I’m confident it should now work also for you, although of course you can use the ValetudoPNG instead of this camera, I putted quite an effort to warranty that Proxmox users could use also this camera.
It would be nice of you when you could confirm if v1.5.3 is actually working on your environment. Thanks in advance for confirming.

@fonix232 Well I found the issue and corrected it on v1.5.3… sorry for that many changes at once… anyhow now the camera support no mop and active segments, there is also the possibility to track the vacuum position knowing the room where the vacuum is at the moment.

This should help to pause the vacuum when you enter in the room that the vacuum is cleaning. I did also improve the rendering.

Thanks :slight_smile: Great work! In the meantime I did manage to fix the issue, albeit unrelated (had to re-add the vacuum due to some MQTT muckery). The new update seems to be working just fine!

Hopefully next year we can also extract the SVG as you requested, I think is a really cool Idea… What do you think if we auto zoom the room where the vacuum is working?
Wish you a great begging of 2024 :wink:

Hi Sandro, thank you for this excellent solution to decoding the mqtt camera. Very easy to set up.

I have one question, is it expected that the room colours disappear after executing a segment clean?

e.g. this:

  - service: mqtt.publish
    data:
      topic: valetudo/roborock_upstairs/MapSegmentationCapability/clean/set
      payload: '{"segment_ids": ["17", "20", "27", "16", "22", "21", "26"], "iterations": 1, "customOrder": true}'

Causes the room colours for these segments to disappear:

All of the rooms are still in the camera attributes.

Happy New Year @tom_l,

In the v1.5.3 I added a function that detecting the active segments, this means the colour is going to be fade 80%.

Screenshot 2024-01-02 at 22.10.16

When not active the colour should return to normal.

Screenshot 2024-01-02 at 22.20.28

Wow, I did not imagine that the this function to show what room is under cleaning can remove the colours the rooms completely, honestly from the test I have done the image was display without any issue as per I didn’t use colours with transparency already setup… (the transparency of the selected active segment goes to value 50 automatically) can you please let me know what are the settings you use for the colours?
Probably I need to add a setting or check to avoid that this happens from the next version v1.5.5 :wink:

I think it was my fault. I had the base colour “zone clean alpha” setting way too low. I have pushed it up to 200 and will do a test room clean now.

I think it is the background colour… more than the zones alpha… anyhow we can change the function actually to display the active segment (that isn’t the active zone) with a different colour instead of simply fade the original room colour. Thanks a lot for the use case… this help a lot to me to figure out what would be the best solution :wink:

Okay… I think I found a solution will use the colour of the room + the zone clean colour to highlight the current active segment, once again thanks a lot for the hint. The next version of the camera will implement this change and also show the obstacles the vacuum found on the path (if the vacuum is supporting the obstacle recognition)

1 Like

@fonix232 working right now on the SVG export… this should be in the next release :wink: anyhow it will export only the floor and walls… hope this is going to be okay :slight_smile:

1 Like

@fonix232 making some test right now the image is exported as SVG but I noticed that on Home Assistant the SVG isn’t fully display in the cards, while the PNG is display in full… in theory I could export the base layer as PNG as per it can be use as a floor map… I could also add the options to resize the image as desired. This would also avoid to reprocess the image. I’ll upload on gitHub the work in progress soon (still possible to export the SVG… file name is test.svg fix) so that probably you can test it and letting me know what do you think about.

Great work, much appreciated!

Could you please show me an example of “not fully displayed”? I’m having a hard time visualising from just your description