This post will be about solving a First World Problem. If First World Problems annoy or offend you, feel free to skip this.
When you have two people and two cats living in a small apartment, things get dirty pretty fast. The cats, much as I love them, are the worst offenders. They can take a spotlessly clean apartment and scatter litter and clumps of fur everywhere within a few hours. Good thing they're so cute!
One of our solutions to this cleaning challenge has been a Roomba 980 Wi-Fi connected robot vacuum. We generally run it once a day. It rolls around the apartment for about 90 minutes and leaves our floors quite clean. I will spare you a graphic description of what happens when the Roomba ingests cat vomit. Other than that, it's been an amazing addition to our home.
For a while, we scheduled the Roomba to run during most business days and would manually kick it off on weekends when we remembered to. But, I'm at home full-time these days, so scheduling is no longer a great option. The Roomba is loud enough that I don't want to schedule runs when I may be at home.
The problem has been that I often forget to manually kick off the Roomba when I'm leaving the apartment. We often forget to manually kick it off on weekends, too. So, we haven't been running the Roomba as often as we'd like to. I took this as an Automation Challenge, and I'm pretty pleased with my solution.
Detecting That I've Left The Apartment
My goal was coming up with a way for my smartphone to detect that I've left the apartment and then kick off the Roomba. For the detection part, I started off looking at IFTTT.
- I only wanted the Roomba to run once a day even though I often leave the apartment multiple times per day.
- I didn't want the Roomba to run at early or late hours when it would bother my wife or our neighbors, even if I happened to leave the apartment during those hours.
- I didn't want the Roomba to run on Fridays, though of course I often leave the apartment on Fridays.
- I wanted a high degree of control over the location detection radius.
IFTTT wasn't helping me with any of those issues. So, I looked for other options.
Integromat for Location Detection and Logic Flow
I first looked at Zapier, as I have used them for robust automation work in the past. But, they don't make smartphone apps. So, Zapier can't directly detect that my smartphone has left my apartment.
Integromat plays in a similar space to IFTTT and Zapier, and they solved all but one of my issues:
- They make smartphone apps that can detect changes in location.
- They support filtering in their automation scenarios, so it's easy to control whether something happens based on logic you define.
- The GPS location in their smartphone apps allows for a high degree of control over the location detection radius.
- Integromat can't kick off a Roomba directly, but more on that later.
Here are example screenshots from Integromat of GPS detection in their Android app. The iOS version looks similar.
The Integromat app on my smartphone (in my case an iPhone) detects that I've left the apartment. That runs an automation scenario on the Integromat cloud. The scenario looks like this.
I use a Data Store on Integromat to store the last time the scenario successfully kicked off the Roomba. The scenario gets that timestamp record each time it runs.
A Filter in the scenario then uses logic to determine if the Roomba should be kicked off.
The conditions the Filter is looking for are:
- It's not Friday.
- It's between 9 a.m. and 5 p.m.
- The scenario hasn't already kicked off the Roomba in the past nine hours.
If all of those conditions are true, the Filter allows the scenario to move on to the final steps. If one of those conditions is false, the scenario ends without kicking off the Roomba.
If I used more than one geofence area with Integromat, I could also have the Filter look for the correct geofence as a condition. But, I only have one geofence, so that filtering is not needed.
IFTTT for Roomba Kickoffs
Unfortunately, Integromat can't kick off a Roomba directly, and Roomba doesn't provide a public API for automators to use. (These would be great things to change if anyone from iRobot is reading this!) So, I have Integromat make a call to an IFTTT Maker Event.
The IFTTT Maker Event then triggers an IFTTT applet.
The IFTTT applet kicks off the Roomba, and I get a notification of that on my phone.
Finally, the Integromat scenario records a new timestamp in the Data Store for when it last successfully kicked off the Roomba.
This will allow the scenario to check that timestamp the next time it runs. The Filter in the scenario will make sure the scenario doesn't kick off the Roomba twice in one day.
All done. Now, our Roomba just kicks off when it needs to. And my wife is so amazed!
Main blog post image by The Creative Exchange.