[APP] Husqvarna Automower Connect

Athom Homey app to control any Husqvarna Automower equipped with Automower Connect.
Note that this does NOT include the limited Automower Connect@Home Bluetooth variant

Where can i find it?

SDK
SDK3 (Homey V5 or later)

Capabilities

  • Activity
  • State
  • Mode
  • Errorcode
  • Batery level
  • Next start
  • Inactive reason

Triggers

  • Activity changed
  • State changed
  • Mode changed
  • Errorcode changed
  • Battery level changed
  • Inactive reason changed
  • Last position changed

Conditons

  • Activity is
  • State is
  • Last position latitude is greater than
  • Last position latitude is less than
  • Last position longitude is greater than
  • Last position longitude is less than
  • Last Position is Inside Any Polygon (https://youtu.be/zXCuQn05Fuk)

Actions

  • Pause
  • Park
  • Park for duration
  • Park until scheduled start
  • Resume
  • Start for duration
  • Poll

Device settings

  • Polling enabled
  • Polling interval

App settings

  • Username (legacy - should not be used anymore)
  • Password (legacy -should not be used anymore)
  • Appkey
  • Appsecret

Installation

  1. Register for a (free) account on Husqvarna developer portal. !!IMPORTANT!! You must use the same login as when you login to the Automower Connect Mobile app! More information here: Husqvarna Developer Portal
  2. Create an ‘application’ in the Husqvarna developer portal and choose to “connect” it to ‘Authentication’ and ‘Automower Connect’ APIs. You must enter a redirect-url but it is not used by the homey app so enter any valid url (eg. https://whatever/redirect). Copy the AppKey and AppSecret, you need them later.
  3. Install the Homey app
  4. Configure credentials (appkey and appsecret) in Homey App settings. Do NOT need to enter username and password, they are present only for backward compatibility.
  5. Press Save changes and close the window.
  6. Add mower as an device in Homey

Now you can use triggers, conditions or actions in your flows or see its status in the device overview.

Homey_Husqvarna_Create_Husqvarna_app_to_get_credentials_v05

A more detailed video on installation can be found here: https://www.youtube.com/watch?v=6ibHUpAF6vI

Where do i enter the credentials?

Consider using you PC browser in favor of a mobile device as copy/pasting can be a hassle sometimes. Click configure here My Homey

As described above you should only fill fields AppKey and AppSecret

Polling and Rate limitations
The Husqvarna API currently has an rate limit of 10,000 calls per month and account. By default this app poll the Husqvarna API every 10 minutes. You can change this in app settings. The flow actions work independent of the polling.

Since version 1.3.5 you can control the polling using the app action/then-flow-card ‘Poll’. Using this you can set ‘Polling enabled’ to No and control this in detail.

Screenshots

[details screen - example where mower power is not on]

Guides or other links
@WebLock has written an excellent guide in Danish on how to install this app here Husqvarna Automower: SĂŠt Homey pĂ„ grĂŠs – Homey.guide

If you create any cool flow using this app - please share below! :slight_smile:

4 Likes

Changelog

  • 1.0.1 minor changes during Athom certification. Updated flow card titles, app image, description, readme

  • 1.0.0 first version available for testing in the Homey Community Store

  • 1.1.0 - Added new error codes from Husqvarna. Added ‘Next start’ capability that displays the scheduled next start. (this version never reached ‘live status’ and was only available in test)

  • 1.2.0 - Added support for Husqvarna Auth API changes. Added auth token caching. New improved multiple mower support. (Thanks to TheodorStorm for his contribution!)

  • 1.2.1 - Minor bugfix to support Homey Pro Early 2023 model

  • 1.3.5
    – Bugfixes
    — Action ‘Pause’ now send the correct command to the mower (bugfix)
    — Trigger ‘ErrorCode changed’ now handled correctly which fixes side effects on other triggers also (bugfix).
    — Fixed minor issue changing the polling settings (bugfix).
    — Removed unnecessary API login which could cause errors requiring a restart during setup (bugfix).
    – New features:
    — Added 37 new error codes from Husqvarna.
    — Added whitespace removal in App configuration credentials dialogue. Could potentially help when copy/pasting credentials on mobile app.
    — Added capability ‘Inactive reason’ recently added by Husqvarna to the mower status.
    — Added trigger ‘Inactive Reason changed’.
    — Added flow token errorcode description to trigger ‘Error code changed’. Eg. in addition to getting errorcode 2 you now can get the ‘No loop signal’ description.
    — Added action ‘Poll’ that will update status independent of the built-in interval-based polling, which allow control of polling from a flow. You can basically disable the built in polling interval and create your own homey based.
    — Added trigger ‘Last position changed’ including tokens with latitude and longitude of last known position.
    — Added 4 new ‘Last position’ condition flow cards for comparing current position (latitude/longitude) with a value. As these can be used independent of any trigger they could allow potential new cool flows.

  • 1.4.2
    Features Added
    – Geopositioning Condition Flow Card ‘Last Position is Inside Any Polygon’. A new geopositioning condition flow card has been introduced, enabling conditional checks against an array of polygons. This feature allows flows to determine if the mower is located within specific areas of your garden. Polygons should be created as GeoJSON structures and passed as an argument to the condition.
    Changes
    – Errorcode capability now support unknown errorcodes needed when Husqvarna add new ones between releases.
    Bugfixes
    – Improved handling when adding missing capabilities.

Thanks very much for developing this!

I’m still on firmware 4.2.0 version on Homey, so I won’t be testing until a stable v5 is released. But I’ll definitely use this app.
At the moment I have my Automower connected via IFTTT that pauses my mowing schedule when the temperature reaches 4 degrees C or lower. Should be easy to build that into a flow with this app. :+1:

Hi, fantastic initiative!
My Homey Pro 4.2.0 will not accept the Husqvarna app for testing the 430x mower.
Can’t wait
:slightly_smiling_face:
Succes with development.

Perhaps premature or over-demanding
My wish is to have a GPS-position trigger of the Husqvarna 430x.

I have three main areas to mow and the 430x only has two connections for lead wires. For example, I want to make two guide wires switchable with a (Tasmota Sonoff 4ch) circuit and let Homey control it with a flow (GPS trigger) when the mower reaches one or another area.
Thx

Yes, that would likely work great. Let me know when you have tested it :slight_smile:

Yes, its v5.0 only as that likely will be out soon. Actually i have been running the 5.0 RC releases for quite some time now with zero issues so far. Let’s hope for a release soon so that we can get you to test the Husqvarna app.

The (official) Husqvarna API does not currently provide access to the mower GPS-position. But i guess if you could find another way of getting the position into Homey or maybe some other way of triggering when it enters a specific area it could be done.

I’ve tested the Husqvarna Automower Connect app ver1.0.1 with my 430X mower. Starting via a Homey flow mowing ( command resume) works, but the other commands did not work ( for testing: polling interval 1 minute). So pauze, park gave no reaction.
Once given the start mowing via Homey the original Husqvarna app did not work anymore.

That sounds strange that one command works and not another. The polling-interval is only related to updating the status in the Homey app. If you send command ‘park’ it send that to the Husqvarna API immediately regardless of the polling-interval. Also, using the mobile-Husqvarna app should not affect the Homey app at all. If i send park from on, the other will reflect this after x minutes. They both use the same API.

If you press test on a simple flow with ‘park’ - do you get a red ‘!’ next to the ‘park’ action or is it green? If it is green then the Husqvarna API should have accepted it.

As soon as the spring is here and i get mine out on the lawn i will help you troubleshoot this :slight_smile:

I discovered the problem.
If you use the command “park” in the Homey flow than the STATE is changed on the Husqvarna server into parked.
So in the Husqvarna app you’ll see the mower is parked and so the park-button in not showed in the app. And so the given pard command will not result in a park action and the mower keeps mowing.
My advise:
Remove all STATe commands from the homey app.
Greetings and thanks for your efforts

Hi Bol, and thanks for trying out the app :slight_smile:

I am not 100% sure i follow. If possible please describe in more detail on what you are trying to accomplish and what you are doing in both Homey and in the Husqvarna app. Could you do a screenshot? When you say that the state is changed to Parked i guess you mean the activity and not state right?

In the mean time it might help for me to explain some more on the Homey implementation.

The ‘actions’ are separated from triggers and ‘display of capabilities’ which both rely on the API-polling. You can use the actions even if you disable polling.

If you send an action (like ‘Park’) the capability activity will (if polling is enabled) change to ‘Going home’ on the next poll followed by a ‘Parked’ x minutes after that. The capability state should not change, it should remain ‘In operation’ the whole time. The triggers and capabilities are not updated based on the actions being done from the Homey app itself, they are only based on changes when polling the API.

The Homey app does not set ‘State’ or ‘Activity’ in the Husqvarna API, that is not possible or allowed. It can only send ‘actions’ to the API.

Could you help me get my mower in the Homey app?

I have followed all the steps you posted but I can’t connect to my mower.
I have the developer account on Husqvarna, however I have not used the same email address as my normal Husqvarna account. So I guess I need to connect the developer account to my normal user account, any ideas how to do that?

Hi @ano_ire ,

The way the Homey app integrates to the Husqvarna API (using Password Credentials grant) requires the account used to be your ‘normal’ Automower Connect account as in the same account as the one you use in the Husqvarna mobile app.

I am not 100% sure but i do not think there is a way to delegate or connect another developer account with your Automower.

Husqvarna has some information here:
Husqvarna Group Cloud - Developer Portal

Any specific reason you can not login with the normal Automower account in the Husqvarna developer portal?

Let me know how it works out! :slight_smile:

Thanks for the help, @BufferOverflow, I changed email address to a new provider so preferred to use my new one. But no hassle, used my old one now (same as my ‘normal’ Automower account) and setup an account again.

I run into an error when adding the device to Homey though,

Tried a reboot of the Homey but to no avail. Settings in app are set correctly.

Any suggestions?

One thing that is easy to forget is to connect the two APIs (Authentication API, Automower Connect API) to your “Husqvarna Application”. It is the “+ Connect new API” option i am thinking of.

If that was not is not it maybe a screenshot from both husqvarna developer portal and the Homey Husqvarna Application settings could help. Don’t forget to obfuscate/hide any credentials.

Thanks for the reply.
I have the Authentication API and the Automower Connect API both connected to ‘My Application’.

See screenshots below:

If I run the test command curl -X POST -d "grant_type=password&client_id=<token>&username=<email>&password=<PASSWORD>" https://api.authentication.husqvarnagroup.dev/v1/oauth2/token on my raspberry pi it seems to get a valid response (not familiar with the language, but seems valid to me):
{"access_token":"<xxxxxxxxx>","scope":"iam:read amc :api","expires_in":86399,"refresh_token":<xxxxxxxxxx>","provider":"husqvarna","user_id":"<xxxxxxx>

And you have used the client_id/application-key and not the secret in the Husqvarna Homey app?

Correct, I’ve used the application key in the Homey app.

Is there a command I can use in terminal to help you with troubleshooting?

Some ideas to test:

  • As you get the auth token you could try the API to get a list of your mower(s) back.

  • Use the PC browser to set the App settings allowing a better copy/paste experience than the mobile. Remove all settings and copy/paste them again. You need to enter husqvarna username (email), password and clientid/app-key. The secret is not used. This is the app-settings page Homey Developer Tools

  • Check that the Husqvarna mobile app work ok.