question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Valetudo RE: Minor improvements for full support

See original GitHub issue

Description

I finally found the time to update to the latest version of your awesome card and tested the vacuum_platform: rand256/ValetudoRE.

I am close to a fully configured card utilizing pretty much all features, which Valetudo RE supports. I posted my configuration in the discussions (see #435).

While most things work as intended, I observed some minor things, which could be improved:

A) vacuum_clean_segment When selecting repeats > 1, the mqtt command appears to be slightly redundant:

{
  "command": "segmented_cleanup",
  "segment_ids": [
    "Schlafzimmer",
    "Schlafzimmer"
  ],
  "repeats": 2,
  "afterCleaning": "Base"
}

with the segment id being repeated as well as the global "repeats: 2" set. As far as I understand the API, only the latter should be done.

B) vacuum_goto_predefined On the card it is possible to select multiple predefined locations, which results in the following command:

{
  "command": "go_to",
  "spot_id": "Sofa,Schreibtisch"
}

Yet only one selection should be allowed.

C) (predefined)zoned_cleanup As I found the room detection of the map to be not as reliable, I have configured several predefined zones on the vacuum. My card is currently configured to handle them like this:

map_modes:
  - name: test
    icon: mdi:select-drag
    selection_type: ROOM
    service_call_schema:
      service: mqtt.publish
      service_data:
        topic: valetudo/rockrobo/custom_command
        payload: >-
          { "command": "zoned_cleanup", "zone_ids": [[selection]],
          "afterCleaning": "Base" }

What I would like to do is to add repeats with:

    repeats_type: INTERNAL
    max_repeats: 3

The MQTT API requests a form like:

{
"command": "zoned_cleanup",
"zone_ids": [
   "Foo",    // zone without repeat can be parsed directly, as done above
   {   // however, zones with repeat have to be encapsuated like this
        "id": "Bar",
        "repeats": 2
   }
],
"afterCleaning": "Stop"
}

D) Auto-discovery of predefined zones/spots/rooms Valetduo RE allows MQTT access to all predefined zones/spots/rooms from the vacuum with custom_command/get_destinations resulting in something like:

{
  "spots": [
    {
      "name": "SpotA",
      "coordinates": [
        32396,
        24058
      ]
    },
    {
      "name": "SpotB",
      "coordinates": [
        24744,
        28526
      ]
    }
  ],
  "zones": [
    {
      "name": "ZoneA",
      "coordinates": [
        [
          28889,
          23472,
          30306,
          24685,
          1    // I do not know what this number stands for
        ]
      ]
    },
    {
      "name": "ZoneB", // apparently a zone can also consist of multiple rectangles
      "coordinates": [
        [
          28475,
          24604,
          30665,
          25960,
          1
        ],
        [
          28676,
          25871,
          30219,
          29701,
          1
        ]
      ]
    }
  ],
  "rooms": [
    {
      "name": "RoomA",
      "id": 18   // the IDs appear to be auto generated
    },
    {
      "name": "RoomB",
      "id": 17
    }
  ],
  "updated": 1643509313129
}

Yet, I have to either write a Jinja2 template and run it each time new predefined zones/spots/rooms are created on the vacuum, or add all of them manually to the card.

Solution

A) Instead of using REPEAT in the platform template, it should be set to EXTERNAL in order to get:

{
  "command": "segmented_cleanup",
  "segment_ids": [
    "Schlafzimmer"
  ],
  "repeats": 2,
  "afterCleaning": "Base"
}

B) Limit the selection of predefined spots on the card to one. Is this possible?

C) Maybe it is possible to add a service call placeholder, e.g. [[selection_objects]] returning the required object-like output?:

[
  {
    "id": "Foo",
    "repeats": 2
  },
  {
    "id": "Bar",
    "repeats": 2
  }
]

D) I know there are some Jinja2 templates available to generate the required code for the card. However, it would be awesome if the card itself could extract these predefined zones/spots/rooms automatically. This way they would always be up to date with those defined on the vacuum.

Alternatives

No response

Context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
PiotrMachowskicommented, Aug 28, 2022

Update

I have added support for:

  • cleaning free-drawn zones and going to point (requires Valetudo RE 0.10.8 or newer)
  • resetting consumables after pressing and holding an appropriate tile.
1reaction
maximwebcommented, Jul 25, 2022
        payload: >-
          {"command": "zoned_cleanup","zone_ids": [{%for s in
          ('[[selection]]')|from_json %}{ "id": "{{s}}", "repeats":
          [[repeats]]}{%if not loop.last%},{%endif%}{%endfor%}],"afterCleaning":
          "Stop"}

I have tested it with the latest built and it works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Valetudo 2022.09.0 · Discussion #1571 · Hypfer ... - GitHub
An interesting newly supported robot plus security and usability improvements. Dreame P2148 Ultra Slim. Thanks to generous user donations, I was able to...
Read more >
Supported Robots - Valetudo
Supported Robots. At the time of writing, (2022-11-20), Valetudo supports more than 20 different Robots. If you're interested in hardware ...
Read more >
Valetudo Newcomer Guide Late 2021 Edition
The Goal of Valetudo is to both remove cloud connectivity as well as provide an abstraction layer so that no matter which robot...
Read more >
Valetudo Newcomer Guide
Valetudo Newcomer Guide. Hi and welcome to the Valetudo Newcomer Guide. This should hopefully answer all the questions you might have and ...
Read more >
Here is my dashboard and automations for my three roborock ...
A slight improvement! ... One thing that Valetudo offers that Xiaomi doesn't is bin time, which lets you pull how long the vacuum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found