[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

Currently available here:

SDK
SDK3 (Homey V5 or later)

Capabilities

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

Triggers

  • Activity changed
  • State changed
  • Mode changed
  • Errorcode changed
  • Battery level changed

Conditons

  • Activity is
  • State is

Actions

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

Device settings

  • Polling enabled
  • Polling interval

App settings

  • Username (legacy)
  • Password (legacy)
  • Appkey
  • Appsecret

Installation

  1. Register for a (free) account on Husqvarna developer portal. You must use the same login as when you login to the Automower Connect Mobile app! Do NOT create a new one. More information here: https://developer.husqvarnagroup.cloud/docs/getting-started#/docs/getting-started
  2. Create an ‘application’ in the developer portal and connect it to both the ‘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://localhost/redirect). Copy the AppKey and AppSecret, you need that later.
  3. Install this app in Homey
  4. Configure credentials (appkey and appsecret) in Homey App settings. You do NOT need to enter username and password, they are present only for backward compatibility.
  5. Add your 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

Where do i enter the credentials?
2023-02-17 16_40_33-Homey Developer Tools and 5 more pages - Personal - Microsoft​ Edge

Consider setting the ‘App settings’ using the PC browser in favor of a mobile device as copy/pasting can be a hassle sometimes. You can reach the ‘App settings’ page using this link : https://developer.athom.com/tools/app-settings

As described in step 4 above you only need to fill fields AppKey and AppSecret. Username/Password is ONLY there for backwards compatibility.

Rate limitations
Note that the Husqvarna API currently has an rate limitation of 10,000 calls per month and account. By default this homey app poll the Husqvarna Automower Connect API every 10 minutes. You can change this in app settings. Note - if your main usage is flow actions to control the mower, you do not need polling and it can be disabled.

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 https://homey.guide/husqvarna-automower-homey-pa-graes

Husqvarna Auth API changes
Husqvarna recently made a change in their Auth API where old/current users still can use the old method (grant_type=password) but a new account can not. It is NOT known if/when Husqvarna will stop support for ‘grant_type=password’ also for older user-accounts. The best way to not having to worry about this is to change your config and add appsecret to the config. You can then remove your username/password.

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

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.