# \[HOWTO\] Create a flow that vacuums the home only when you're gone (and stops when you arrive early)

**URL:** <https://community.homey.app/t/howto-create-a-flow-that-vacuums-the-home-only-when-youre-gone-and-stops-when-you-arrive-early/57923>\
**Category:** Tutorials\
**Tags:** flow\
**Created:** [January 6, 2022, 10:52am UTC](https://community.homey.app/t/howto-create-a-flow-that-vacuums-the-home-only-when-youre-gone-and-stops-when-you-arrive-early/57923 "2022-01-06T10:52:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [January 6, 2022, 10:52am UTC](https://community.homey.app/t/howto-create-a-flow-that-vacuums-the-home-only-when-youre-gone-and-stops-when-you-arrive-early/57923/1 "2022-01-06T10:52:00Z")

</div>

My robot vacuum is only programmable on times. Especially with working from home that is not ideal. I do not want to be disturbed while I am working.

**Situation**  
You want your robot vacuum to clean while you are not home, but just once a day. You never want to be bothered seeing the thing at work.

**Prerequisites**  
You need a vacuum connected to Homey. And your geofencing needs to work (for all members of the house).

**Good to know**  
Unfortunately I cannot add my new vacuum to the Xiaomi app due to an error. You’ll see empty or unavailable cards.

**Let’s get started!**

_STEP 1_  
We need a few variables to make sure it does what we want.

1. Variable _Stofzuiger bezig?_ (or _Vacuuming?_), _boolean_, set it to _false_.  
This indicates that your house is actually being vacuumed right now.

2. Variable _Gestofzuigd vandaag?_ (or _Vacuumed today?_), _boolean_, set it to _false_.  
When the vacuum finishes the while task, this will mark it so.

_STEP 2_  
We create a flow that will start the vacuum.

 ![Schermafbeelding 2022-01-06 om 11.36.04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/0/a0ea16a0ee8adbdbfe25835d228ccb5ce3673312.jpeg)

How does this flow work?

- The flow starts when the last person leaves the house.
- Optional: I’ve added a time slot where I do want to vacuum.
- As I only want the vacuum to vacuum once per day, I check if it already made a complete cycle.
- If both conditions pass I fire up the vacuum! I also set both variable to true.

_STEP 3_  
We create a flow when somebody returns to the house.

 ![Schermafbeelding 2022-01-06 om 11.40.25](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/9/d95ff133fcee47e7bfe62a2b9d8559818c049635.jpeg)

How does this flow work?

- The flow is started when someone enters the geofence.
- If the vacuum is busy, the flow continues.
- It stops the vacuum and commands it to return to the dock.
- I set both variables to false (it didn’t run a full cycle).

_STEP 4_  
If the vacuum finishes his cycle, we need to register that.

 ![Schermafbeelding 2022-01-06 om 11.43.34](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/2/82eddf86ec6ab3e5600ee78a8a106a49266870b2.png)

How does this flow work?

- The trigger is where the vacuum status changes to charging. Because: if the vacuum returns after finishing, that is the status it’ll have.
- We check if the variable is set to true. This eliminates the charging status we also have in step 3.
- As a result we change the other variable to no.
- We leave the _Gestofzuigd vandaag?_ variable untouched. Because the vacuum made a full cycle, so even when you leave the house again, it will not do another cycle.

_STEP 5_  
We need a daily reset! The _Gestofzuigd vandaag?_ variable needs to be set to _false_ at midnight.

 ![Schermafbeelding 2022-01-06 om 11.49.31](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/c/1c8a46aa926389366a6fabd33026f1c51fb9a27f.png)

How does this flow work?

- At (one minute) for midnight this flow runs.
- It sets the variable to _false_ for another day of cleaning!
