Automower™ Mapping in Grafana

drew
3 min readJun 6, 2021

--

435X on an Incline

Robotic lawn mowers are quite cool and have advanced quite a bit in the past few years with the launch of an AWD model in late 2019 from Husqvarna.

What is incredibly interesting to observe is where the mower is located and has been over different time intervals. The mobile application provides the last ~50 GPS coordinates on a Google Map overlay which is very cool but provides no historical coordinate views — a very much missed opportunity at this time.

Map w/Satellite Layer Toggle

Husqvarna has an Automower Connect API which is fairly easy to use but unfortunately it doesn’t return location data. The API that is being used to display this data in the mobile application is likely the legacy (undocumented / unsupported) API hosted at husqvarna.net. The best utility I have found to operate with this API is pyhusmow (marked read-only).

Prometheus Data Collection

The easiest way to get the GPS coordinates available in Grafana will be Prometheus. Given the aforementioned pyhusmow utility is written in Python it seemed logical to put together a small metric collector / exporter in the same language in case any interoperability / simplification was possible.

A very simple collector / exporter:

A small prometheus configuration addition:

- job_name: 'mower_location'
scrape_interval: 30s
static_configs:
- targets: ['localhost:8182']

Assuming you have husmow server running, have configured a script such as the above, and updated / restarted prometheus — you should now be able to see your metrics in Grafana.

Automower Metrics

Grafana Mapping Visualization

The plugin for visualization that I have chosen at this time is TrackMap as it was trivial to install and uses the OpenStreet backgrounds which meant less upfront configuration.

After installing the plugin, and adding a panel to a dashboard — the two metrics need to be specified as follows:

Metric Configuration

That’s it.

Enjoy

Enjoy your browsable coordinate history of Automower™ data.

Follow that Mower!
6hr View

But Why Didn’t?

  • I use Home Assistant? Home Assistant is a garbage fire. It used to have an automower component that is now separate. Under the hood this actually just uses husmow if you take a peek. In addition, it doesn’t seem to export the coordinates in a standard manner that are picked-up using the standard Prometheus exporter in Grafana. Writing this took less time than debugging the mess that is Home Assistant + HACS + Component code.
  • Reach out to Husqvarna and ask? I sent them a note, curious if I will ever hear back or this is on their supported API / App roadmap.
  • Use the Alexandra Track Map plugin vs. the TrackMap Plugin? Maybe it is better — But upon installation, it throws an error (someone reported here & that thread appears confused).
Competition Awaits

--

--

No responses yet