#Create array of numbers

1 messages · Page 1 of 1 (latest)

hazy jungle
#

Hi everyone,

I’m currently using the Roborock integration to clean the rooms in my house, and I’ve set up an automation that checks every 15 minutes if any rooms are ready for cleaning (based on specific pre-conditions). If a room is ready, the cleaning process starts.

The integration works by sending a command with an array of room numbers to be cleaned. However, right now, I’m handling this one room at a time. This means the robot cleans a single room, then returns to the docking station to empty its dustbin before starting the next room. When cleaning five rooms in a day, this process repeats five times. I’m concerned that this frequent docking and cleaning cycle could reduce the robot's lifespan.

To optimize this, I’d like to change my automation so that it checks the pre-conditions for each room and builds an array of all rooms that are ready for cleaning. Once the array is complete, the robot would clean all the rooms in one go and return to the docking station only once. If the pre-conditions change during the day, there might be multiple cleaning runs, which is fine, but I want to minimize unnecessary trips to the dock.

The challenge I’m facing is how to create and manage this array within an automation and then pass it to the Roborock cleaning action or script. Does anyone have experience with this or ideas on how to implement it? Any help would be greatly appreciated!

Thanks in advance!

severe hatch
#

What I would look to do is create a mapping of area_id -> room id number - something like

{% set rooms = {"living_room":0, "kitchen":1 ...}

You can then make your list by looping through the areas, checking the preconditions, and adding them to the list to send to your vacuum

{% set ns = namespace(room_list=[]) %}
{% for area_id, room_number in rooms | items %}
  {% if [insert prerequisites for area_id] %}
    {% set ns.room_list = ns.room_list + [room_number]
  {% endif %}
{% endfor %}
{{ ns.room_list }}
hazy jungle