Configuring your Home Assistant to control your Shark Vacuum
With the recent (mid to late 2024) change to Shark's authentication method, the Shark Integration on Home Assistant stopped working. Leaving many of us with difficulty trying to control our Shark Vacuums with our Home Assistants. If you're like me, I've come to rely on the capabilities and automation of my Home Assistant. And while I've not yet scratched the surface, I have been able to make my life easier with scheduled tasks and fun automation.
What do I need to get started?
- Shark AI Robotic Vacuum (Connected to Google Assistant)
- Home Assistant installation with HACS (not required but makes it much easier, install info)
- Google Assistant SDK Custom (Install using these instructions)
- Some patience
- Creative ideas (not required if you just want to follow along to this tutorial)
Getting Started
I'm a big fan of linking back to the original documentation for an application if it's available so that it stays current. To set up your Google Assistant SDK Custom you will want to follow the information found on the official Home Assistant integration page, except instead of using the Google Assistant SDK service you will want to use the one I linked above. Those instructions can be found here.
Once you have your Assistant SDK configured you can begin to write your scripts and automations. I have a few different scripts to manage different functionality and updates, and I'm sure there's better ways to do it, but this is how I've done it.
Helpers
- input_text.tempdata
- input_text.vacuum_status
- input_boolean.varvacuumdock
- sensor.tempvacuumrunning
| Template design of sensor.tempvacuumrunning |
Scripts
- Shark Clean
- Update Vacuum Status if Running
- vacuum_status_refresh
The main script used to update the Helpers listed above is the vacuum_status_refresh. This script calls out to the Google Assistant SDK with a text command, waits for a response, sets the response data to the input_text.tempdata, calls the Update Vacuum Status if Running script, then sets the input_boolean.varvacuumdock status based on the input_text.vacuum_status variable that is set in the other script.
"vacuum_status_refresh" script
I recommend as you are building the following script to run your vacuum and call the first action of the script before you add anything else. Then you can go into the Traces, go to the "Changed Variables" tab, and review what the response was from the Assistant. As you can see here, the response from the Assistant is quite odd, but this is the text I will be looking for in my responses from the Assistant for all of my handling going forward.
"Update Vacuum Status if Running" script
This is where you will need the data from the trace we did earlier on the "vacuum_status_refresh" assistant action. Because we need set a text field, we use a conditional if then else action.
For the input text fields I just set the text statically to the text I want to display on my dashboard. In this case, if true, it shows "Botty McBotFace is running." and for every other response that might come from Assistant it shows "Botty McBotFace isn't running."
"Shark Clean" script
This one I built entirely in YAML to get the functionality right. You need to ensure your rooms / zones in the Shark app have a text name assigned to them for this piece to work. For the options, use whatever combination you want for these, but you will need to ensure you have "clean", "stop", and "return to the dock" as options.
Automations
Update Vacuum Status every 20 Min (not required, I just like to have my dashboard updated)
Clean Hallway (or any other room / combination, I have a number of these configured for scheduling, if you're going to schedule using a plugin there's no need for a trigger on these)
Botty McBotFace Cleaning (name this whatever you want, I just named my vacuum Botty McBotFace, this automation handles playing music around my place, sending notifications to my phone, and stops music after the vacuum is done running)
Dashboard
I spent some time making my dashboard how I like it. If you want to make button cards like mine, you can do so with some pretty basic settings.
4 comments
Have you noticed your vacuums listed as offline alot in Google Home?