Husqvarna AutoMower Integration

This application and driver provides Integration for Husqvarna AutoMower.

it allows you to monitor and control basic mower operations via the Husqvarna API.

It is available now in HPM

or

It consists of an application and a device hander (App will create the child devices once configured).

After you install you have to get an API key and secret from Husqvarna to securely connect to their API:

Instructions:

DO NOT SHARE THIS KEY OR SECRET WITH OTHERS

  • Add app on HE
    - HE console -> Apps -> "+ Add User App" and select Husqvarna Connect

  • App during configuration will have you enter the API key/secret, and have you go thru the OAUTH process to connect securely to the Husqvarna API. The app will handle Oauth refreshes automatically.


  • Note: currently Husqvarna API allows a total of 10K requests a month per application (and they only let you create 1 per account). This app must poll so this must be taken into your decisions on polling rate.

    • This works out to shortest poll is every 5 minutes, with little remaining headroom so likely 10 - 15 minute polls are better

    • I don't know this, but I expect the mobile apps for these products from Husqvarna also share the total API limits, so longer poll times are likely your friend.

  • This API for Husqvarna is also used for their Gardena line of products (and they all share the above limit). I don't have these other products so I have not added drivers for them.

In addition to custom attributes based on the REST API from Husqvarna, the mower device also exposes battery, motion sensors, and power source.

  • battery shows charge %
  • motion is active while moving/mowing, and inactive when stopped, or parked.
  • powersource is battery or mains (when charging)

Custom attributes:

  • mowerStatus -> MAIN_AREA, SECONDARY_AREA, HOME, DEMO, UNKNOWN

  • mowerActivity -> UNKNOWN, NOT_APPLICABLE, MOWING, GOING_HOME, CHARGING, LEAVING, PARKED_IN_CS, STOPPED_IN_GARDEN

  • mowerState -> UNKNOWN, NOT_APPLICABLE, PAUSED, IN_OPERATION, WAIT_UPDATING, WAIT_POWER_UP, RESTRICTED, OFF, STOPPED, ERROR, FATAL_ERROR, ERROR_AT_POWER_UP

  • mowerConnected -> TRUE or FALSE

  • mowerTimeStamp -> LAST TIME connected (EPOCH LONG)

  • errorCode -> current error code (long list with meanings in API site)

  • errorTimeStamp -> (EPOCH LONG)

  • plannerNextStart -> (EPOCH LONG)

  • plannerOverride -> Override Action

  • name

  • model

  • serialNumber

Commands supported:

  • start(mins) - start mowing for x minutes
  • pause - pause operation
  • park(mins) - park for x minutes
  • parkuntilnext - park until next schedule start
  • parkindefinite - park until someone takes you out of park
  • resumeSchedule - resume operations based on schedule settings

At some point I will add some apps. Initial thoughts:

  • park the mower for rain event and time after (your lawn floods)
  • don't let the mower operate if it is cold (or hot)
  • don't have the mower show off during a party (or if something is turned on like the sprinklers)
  • alert me if the mower is angry or otherwise bothered

There is a user written app that does some of this:

8 Likes

Reserved for future use

Great you’ve released this. I’m still deciding on which mower to buy.
Is there any access to real-time GPS position via the Husqvarna API whilst mowing ?

It does in the API include coordinates (which I did not expose in attributes)

Their mobile app shows a map view that has both where the mower is now, and if is running where it has recently been.

If the mower is removed from a circle around the property area, it gets very angry...

The API also exposes some of the schedule data, which I did not expose in attributes.

1 Like

Now if they only made these in 52" cut. :scissors: With my almost 4 acres, these AutoMowers are so appealing but would be out of their league.

Cool integration though! I was wondering when somebody would do this. Not surprised you did it first, good job!

I'm in the same boat, a little over 3. When we get rain like we have had the last few weeks and I can't get out to mow like I need to, even my Exmark has a time cutting it.

1 Like

After clicking Authorize I just get a blank page and it still says that I need to authorize in apps.
I get this from the log,

error AutoMower App (v00.00.01) | groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request on line 590
error AutoMower App (v00.00.01) | auth callback() Exception: groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request

What am I doing wrong? I have Tripp,e checked my key and secret…

Did you install with HPM?

If so please do a HPM repair and retry.

That did things happened. :slight_smile: Now I got a lot ore options and authorize went fine. Thanks!

Hi @nh.schottfam , I have managed to get the device to connect. I can see status of it etc. However I can't start it from hubitat. I do get this errors (see log below , I cleaned the mower-id so the log looks ok for that). I insalled it with HPM and have tried to repair with that as well.

Also a request ( if I managed to controll it I will try fix this my self though):
add capability Switch or similar so we can controll it from tile master.

Logs

app:3612021-07-27 21:59:31.598 info AutoMower App (v00.00.01) | refreshAuthToken(sendCmdToHusqvarna, null) | Token is valid | exiting, token expires in 67884.786 seconds

app:3612021-07-27 21:59:31.592 errorAutoMower App (v00.00.01) | groovyx.net.http.HttpResponseException: status code: 500, reason phrase: Internal Server Error on line 907

app:3612021-07-27 21:59:31.584 errorAutoMower App (v00.00.01) | sendCmdToHusqvarna(mower: xxxxxxxx, data: [data:[type:Start, attributes:[duration:null]]], isRetry: false) | ___exception Exception: groovyx.net.http.HttpResponseException: status code: 500, reason phrase: Internal Server Error

start requires you to provide the duration for the run.

If you want to just resume your schedule, use resumeSchedule.

Hey everyone,
I have been trying to integrate my mower with HE, but upon getting the app all set up and working it cannot seem to find my mower ("No mowers found to connect").
Has anyone else had, or solved this issue? I have uninstalled/reinstalled the app but still no luck.
It doesn't seem to be a connectivity issue as I have got it working with Alexa, and the Husqvarna phone app. So I'm a bit lost.
@nh.schottfam , Do you have any insight into this?

Ensure you followed all the steps in first note of this thread to create the application in the Husqvarna cloud site. (sign in, create application, connect the application to the authentication and mower api)

Ensure you use your primary credentials.

I won't have mine back out for a couple months, so I cannot do much debugging now.

Thanks @nh.schottfam for getting back to me. Unfortunately I did follow all those steps and it's still not showing up.
No worries tho, thanks again for your help, I'll keep messing around with it and if I don't get anywhere, maybe I'll be in touch again in a few months! :slight_smile:

Could this integration be revised to exploit websockets, so that it doesn't have to poll?

I myself don't know much about websockets or coding HE to use them, so it would take me a bit to figure out. Perhaps you might know...

1 Like

@nh.schottfam I submitted a pull request on github for adding additional capability to this driver, including support for changing the schedule, the cutting height, and the headlight mode. These additional capabilities will support apps like MowBot Tamer.

EDIT: Thanks for the quick response and for accepting the pull request!

not working get this error trying to set up

ok more info.. i can get it to connect if i create an entirely new account on husq. but off course that doesnt work as there is no mower under that account so app does not find mower.. appareantly you cannot use the same account as the husq app which does have the mower or you get the error shown above.. bummer.. any ideas.

I guess in private message you should show me the application you created in the Husqvarna developer site (note 1 instructions).

My first impression is something is not right there.

i will but that is obvious wrong as it wouldnt have worked iwth the second account i setup then..

my feeling is that the redirect uri is being used for the husq app and that is why i cannot add a differnt one here. if the keys were wrong i would not get any communication