rand256 / valetudo

Valetudo RE - experimental vacuum software, cloud free
Apache License 2.0
667 stars 73 forks source link

custom_command, segment_ids. What is wrong? #504

Closed labaland closed 1 year ago

labaland commented 1 year ago

Hi! Sry bad english :P I did not find any answer on my question after a lot of google searches.

I want to be able to start a cleaning for multible rooms at once from HA and i followed this guide: https://valetudo.cloud/pages/integrations/home-assistant-integration.html

So after following that guide i can get the rooms id's i want to clean like this: ["17","19","21"]

        variables:
          segments: '{{expand("group.vacuum_rooms") | selectattr("state","eq","on")
          | map(attribute="attributes.room_id") | list | to_json}}'

The problem is i cant start the cleaning with this service:

    - service: mqtt.publish
      data:
        topic: valetudo/slaven/custom_command
        payload_template: '{"segment_ids": {{segments}}}'

But if i change ["17","19","21"] to [17, 19 , 21] it works..

I get this in the log on my vacuum: "2023-07-16T06:25:32.955Z MQTT Error : segmented_cleanup : Invalid segment_ids"

How do you guys doing this?

labaland commented 1 year ago

with some templates i got it to work with service: vacuum.send_command.

But i would like to know how to make it work with mqtt also :)

rand256 commented 1 year ago

Your guide is meant for Valetudo not Valetudo RE.

In Valetudo RE the segmented_cleanup decides what you've passed to it by the type of a variable. It assumes that any string you pass is a segment name and any integer you pass is a segment id. So basically you may have a segment named 10 with an id equal 20, and then you can clean it either by specifying "10" (with quotes) or 20 (without quotes) in segment_ids list.

As for HA integration - I can't help, I'm not using it and never did.