drew

Jun 28, 2021

4 min read

It’s 10pm, do you know where your Automower™ is?

Google Assistant Actions are pretty interesting and it would be pretty cool to be able to create an Action that would tell you the location of your Husqvarna Automower relative to your property along with additional information such as when it was last seen, and the battery charge.

Where is Fred?

As would be expected — this doesn’t exist as it would require gluing together several separate pieces:

  1. An unsupported Husqvarna API.

So, let’s build it.

To Build

Get That Data

The data we require is in the response from the unsupported Husqvarna API. I wrote about this previously here.

Assuming that you are running the same collection server locally based-on husmow, you would be able to also run a service that defines your areas in your yard and how you want them represented.

Script / Service to collect (and write) the data:

Google Action Get / Set

This shouldn’t require too much customization but the main part that needs to be catered for you is the areas you would like to define. You can use any map coordinate software that you would like to define the boundary box for each area and then the language that you would like to define that area if your mower is found within it.

Ignore the SAVE_API until the next section where we write this data to be then read by a Google Action.

Writing the Data

To be able to have the data available to a Google Action, it needs to be readable from a conversational webhook.

For this, we can have a simple Google Cloud Function that allows reading the status and writing the status. One note: This is entirely public so if you have any concern for privacy of your mower / mower data — you should consider other options.

Your function can be as simple as follows:

Automower Cloud Function

This writes a message to Google Cloud Datastore and reads that same key (message) out. The key is deployed in-line which is not secure.

Once deployed, you can simply request the current status with:

curl https://<YOUR FUNCTION URL> cloudfunctions.net/automower

Now you may update the previous service / script with your Cloud Function URL.

Creation of the Google Action

The Google Action(s) interface and setup process is absolutely terrible. It might be one of the most confusing onboarding / quick start processes I have seen with a product lately — but it does rival the confusion of Google Cloud Datastore in Native or Datastore mode (or is it Google Cloud Datastore Firestore in Native Mode Wednesday Afternoon Australia Day?).

  • Create or use an existing GCP Project on https://console.actions.google.com.
Main Invocation
  • Head down to the Webhook and let them manage / deploy the function. It can be very simple with the following:
Webhook Function

This will look like this, in the console:

Webhook Console Function
  • Deploy and head over to Test.

Enjoy!

If you made it through all of the complexities of build / deployment, setting up of a Google Action, creating an Alpha release, et cetera then you will enjoy the outcome-

Recent Data Demo
Old Data Demo

ToDo

  • It’d be nice to get the Action out of Alpha mode to be able to customize some of the settings a bit more. To do this doesn’t really seem possible with Google’s ToS (attempted and denied multiple times).

Glossed Over

This was not meant to be a thorough or step-by-step tutorial. That would likely be a much more involved and potential unreadable document. The complexity with setup, build, and deploy have just gotten to a point when connecting this many pieces that it is quite difficult and time consuming to document for others which is unfortunate.