Project: Husqvarna Automower in Home Assistant - set up the API, then add a "mowing finished" notification, a rain-dock

Discuss Smart Mowers including APIs and Integrations
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

A step-by-step project for connecting a cloud-connected Husqvarna Automower to Home Assistant and building three useful automations. It follows the Home Assistant Husqvarna Automower and Lawn mower integration pages as at October 2026. I have not run this on my own mower, so check the docs for your model and post what you find. It only applies to mowers with Automower Connect or the Automower Connect Module.

Step 1: Create the Husqvarna API application
  1. Sign in to the Husqvarna Developer Portal with the same account you use in the Automower Connect app, and authorise the portal when asked.
  2. Go to "My applications" and create a new application. Name it anything (for example "My Home Assistant"). For the redirect URL use https://my.home-assistant.io/redirect/oauth, with no extra spaces on the end. If you have My Home Assistant disabled, the HA docs say to use your Home Assistant URL followed by /auth/external/callback, exactly as used during setup.
  3. Click Create. You get an Application Key and Application Secret. The HA docs say to protect them like a username and password.
  4. Connect two APIs to the application: the Authentication API and the Automower Connect API. Leave the tab open.
Step 2: Add the integration

Go to Settings > Devices & services > Add integration > Husqvarna Automower. Enter a name for the credentials, paste the Application Key as the OAuth Client ID and the Application Secret as the OAuth Client Secret, then follow the prompts to log in with your Husqvarna account. If you get a credentials error, delete the credentials on the Application credentials page and try again.

You should get a lawn_mower entity, battery and status sensors, a calendar, and (depending on the model) buttons such as Confirm Error, Sync clock and Reset cutting blade usage time, and switches for stay-out zones and work areas. The HA docs mention a Sync clock button, which is handy after daylight saving changes.

Step 3: Notify when mowing is finished

The Lawn mower docs include this example (adapt the entity IDs, which will probably be lawn_mower.your_mower_name):

Code: Select all

alias: "Notify when the mower is done"
triggers:
  - trigger: lawn_mower.returned_to_dock
    target:
      entity_id: lawn_mower.backyard
actions:
  - action: notify.send_message
    target:
      entity_id: notify.my_device
    data:
      message: "The backyard mower is back at the dock."
Note: the docs describe "returned to dock" as the trigger. The Husqvarna integration also has a "battery charging" binary sensor that is on when the mower returns to charge, including after low battery, so you may want to filter. Test it over a few mowing cycles.

Step 4: Send it home when it rains

Most mowers have their own rain sensor. This is an extra for cases where you have a better local rain sensor or a weather station. Also from the Lawn mower docs:

Code: Select all

alias: "Dock the mower when it starts raining"
triggers:
  - trigger: state
    entity_id: binary_sensor.rain_detected
    to: "on"
conditions:
  - condition: lawn_mower.is_mowing
    target:
      entity_id: lawn_mower.backyard
actions:
  - action: lawn_mower.dock
    target:
      entity_id: lawn_mower.backyard
Replace binary_sensor.rain_detected with your own sensor (a Weather integration, a rain gauge, a Zigbee rain sensor, etc.). Consider adding a delay or a "stays on for 2 minutes" duration so a few drops do not send it home. The dock action sends the mower home. On the Husqvarna integration, the lawn mower entity's "park until next schedule" option is the other way to stop it.

Step 5: Override the schedule when you want an extra cut

Per the HA docs, lawn_mower.start_mowing only works during the schedules defined in the Automower Connect app, and the battery must be fully charged. To mow outside the schedule, use husqvarna_automower.override_schedule, which lets the mower either mow or park for a given duration, overriding all schedules. Use the Developer tools > Actions page to try the action and see the fields for your version before putting it in an automation.

Ideas: mow only when the "garden is empty" (nobody home, pets inside), or skip the schedule on days when there is a party or a sprinkler schedule runs.

Safety and security
  • Never rely on an automation to make a garden safe. A mower blade can cause serious injury. Do not start the mower remotely if people or pets might be on the lawn.
  • Keep the Application Key and Secret private. If they leak, delete the application on the developer portal and create a new one.
  • Rate limits: the openHAB Automower binding docs state Husqvarna's application key limits as 10,000 requests per month and 1 request per second. Do not write automations that poll the API in a loop.
  • Leave the mower PIN set and enable its alarm so a stolen mower is useless.
Links
Question for the group: what automations do you run with your mower (rain, schedule overrides, "only when we are out")? Has anyone found a good way to avoid it mowing during a pool party?
Post Reply

Return to “Smart Mower Discussion”