Rearranging values stored in helper

Ok. I have a semi odd scenario. I have my robot vac integrated into HA and I have rules for presence detection to run when most everyone is out of the house ect and when they return the vac goes back to the dock.

However, some times that timeframe of being out of the house is not long enough to vacuum everything. So a room or a couple rooms get missed. Then the next time the automation runs, the more recent rooms get cleaned again.

So I have an idea. Since I have each room mapped out and I can send a json packet to the vac telling it to vac. I was wondering if it’s possible to store and rearrange values in a helper.

Example:

Monday - Vac automation runs. The room order of {1,2,3} is sent to the vac. room 1 gets done, someone comes back home, vac is back on the dock. What I would like to do at this point is now rearrange the order since the automation has run with this order.

Tuesday - Vac automation runs. This time the order sent to the vac is {2,3,1}

Wednesday - {3,1,2}

Basically rearrange so the most recent cleaned room gets moved to the end. I was wondering if this is possible by using a list or something but didn’t see a “list” entity that would persist reboots. Thought maybe a text helper, but I am guessing I would need to use a script and add that to the automation so it then takes the value, rearranges it and stores it back?

Still working my around in HA. Thanks!!

Just quickly thinking about it I think I would use an input_select.

you can set the options for the rooms (1,2,3) and as the vac finishes cleaning the rooms use that data to run the input_select.select_next service.

It maintains it state thru restarts so it will always know what option was last selected. using that state and deciding if the vac finished cleaning the selected room you can choose to clean it again or move to the next “room” (next option).

you can also re-arrange the options but I don’t think it will be necessary using the functionality above.

I don’t have a robot vac so it’s all theoretical but I think it wouldn’t be too hard to work something up using an automation with different “choose:” branches.

1 Like

ah that’s awesome!! Ill look into it. Didn’t know that was even a thing but that sounds exactly what I need!!

Ill play with it and report back! thanks for the suggestion

1 Like

Ok. Played around with it. It’s close!!

I can easily rotate through the list. But, I haven’t quite been able to figure out how to go about providing the full list as a value.

For instance. If the current input_select value = 2. I need to send to the vac, {2,3,4,5,1}

So I need to figure out how to iterate through the rest of the list or something like that.

What about having the order always fixed and only save the last position the vac was in.

So order is an array [1,2,3,4,5].
When vac is sent home, save position in input number.

Next time it’s going out for a walk send it to input number +1.
Not sure how you actually send the order to it, can it be sent one at the time or does it need the full plan?
Can you send it to room 2, and when it’s done does it say “I’m done” and you can send it room 3?
Because that “I’m done” is an easy trigger, and also an easy way to update the input number.

When I ran the cleaning cycle today I was watching to see if i got a notice when it finished cleaning a room and headed to the next. No signal sent on that. I can send it to 1 room at a time. If I wait till it’s “done” command that interferes with the current automation I have that intercepts it returning to the dock and instead send it to sit by the trashcan to be emptied.

Send it on a full house clean I was thinking on sending it all the segments so if there is time it will just keep cleaning until either it’s done or someone comes home.

If I don’t do the trashcan thing, I can catch when it finishes one room, do the input_select.next and send it to there. Might have to add some other conditions when it triggers “go to the dock” need to make sure that if it’s going to the dock and it’s because we are home, it doesn’t think it finished a room and send it to the next room :slight_smile:

But definitely possible.

How would you know which room it made it to (and then actually completed) before someone came home if it didn’t complete the entire cycle?

it doesn’t sound like there are any intermediate “I just completed this room” data sent. So you will likely be stuck doing one room at a time.

How often does it need emptied? if it only needs emptied after a complete 5 room cycle then you could use the “room 5 completed” info and then use that to send it to the trash can.

1 Like

primary logic i was going off of was even if we just run down to the convenient store down the way (the closest place we would leave the house to go to) and back that is enough time for at minimum 1 room. That was the sketchy logic I was going off of :slight_smile:

Once the rooms are cleaned regularly maybe after a full house clean.

I have some time this weekend, i may pause my current automation and play with doing the room by room. See how that plays out.