Automower Binding (G2)

Hello Michael

Your integration with automower connect looks great. I have an 430x since a few days and Im also interessted to integrate it in OH.
May you provide details (how did you add the pyhusmow?)
Are you able to control it or only get the status?

Thank you and best regards

Michael

Hallo,

ich brauche Hilfe beim Binding mit OpenHab2 und meinem Husqvarna ACX260.

Können sie mir helfen?

Freundliche Grüsse
Mike

I’m about to purchase the same Husqvarna Automower 430X.

I noticed that these recent models have an API, and are able to connect to Alexa, Google Home, IFTTT (see this link). This makes the Robonect module or any other other hardware unnecessary (at least for the models that have Automower Connect).

Specific API documentation can be found here:

Does anyone have experience with this API?

1 Like

Im think about start developing a binding for husqvarna mowers. Currently I use the previously mentioned pyhusmow solution. But would like to have more flexibility, eg. set weekly timer. I started testing the Husqvarna Group API and the auth process is quite clear. I still have to test setting new timers. But I‘m optimistic to be successful there. Everything works fine manually with Postman. If someone has already started some work, it would be nice if the source can be shared somewhere.

3 Likes

Hello how far are you with the binding?
I would be happy to test it.

I not really started, except setting up the development environment (which is up-and-running)
My spare time is limited atm. But I hope to free more time from mid december. Anyway, my mower currently hangs around as the season is over :wink: I will post a new thread as soon something is ready to test.

1 Like

If you have the source public on github I can help you with the development.

I am not a Java Guru but I have done some bindings.

/mike

Any updates on this?

Any updates on this?

Hello,

I am working on a Rest Web-Service Interface based on an esp 8266. So needed Hardware would be about 4€. The first tests seems to work fine. I will hold you updated.

Here’s how to control your Husqvarna Automower:

Create an Application at https://developer.1689.cloud/apps
You can log in with your Husqvarna Automower Connect app credentials (<YOUR_EMAIL> & <YOUR_PASSWORD>).

Add Authentication API and Automower Connect API to your application.

Take note of your Application key <YOUR_APPLICATION_ID> as you’ll need it later.

  1. Get your ACCESS TOKEN:
    curl -X POST -d “grant_type=password&client_id=<YOUR_APPLICATION_ID>&username=<YOUR_EMAIL>&password=<YOUR_PASSWORD>” https://api.authentication.husqvarnagroup.dev/v1/oauth2/token

  2. Get your MOWER ID (in case you don’t know):
    curl -X GET “https://api.amc.husqvarna.dev/v1/mowers
    -H “accept: application/vnd.api+json”
    -H “X-Api-Key: <YOUR_APPLICATION_ID>”
    -H “Authorization: Bearer <ACCESS_TOKEN>”
    -H “Authorization-Provider: husqvarna”

Here’s your mower ID:
{
“data”: [
{
“type”: “mower”,
“id”: “<MOWER_ID>”,

  1. Get info on your mower:
    curl -X GET “https://api.amc.husqvarna.dev/v1/mowers/<MOWER_ID>”
    -H “accept: application/vnd.api+json”
    -H “X-Api-Key: <YOUR_APPLICATION_ID>”
    -H “Authorization: Bearer <ACCESS_TOKEN>”
    -H “Authorization-Provider: husqvarna”

  2. Command your mower, some examples:
    Start mower, duration 10 minutes:
    curl -X POST “https://api.amc.husqvarna.dev/v1/mowers/<MOWER_ID>/actions”
    -H “accept: /
    -H “X-Api-Key: <YOUR_APPLICATION_ID>”
    -H “Authorization: Bearer <ACCESS_TOKEN>”
    -H “Authorization-Provider: husqvarna”
    -H “Content-Type: application/vnd.api+json”
    -d “{“data”:{“type”:“Start”,“attributes”:{“duration”:10}}}”

Park duration 30 minutes:
curl -X POST “https://api.amc.husqvarna.dev/v1/mowers/<MOWER_ID>/actions”
-H “accept: /
-H “X-Api-Key: <YOUR_APPLICATION_ID>”
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Authorization-Provider: husqvarna”
-H “Content-Type: application/vnd.api+json”
-d “{“data”:{“type”:“Park”,“attributes”:{“duration”:30}}}”

ParkUntilNextSchedule:
curl -X POST “https://api.amc.husqvarna.dev/v1/mowers/<MOWER_ID>/actions”
-H “accept: /
-H “X-Api-Key: <YOUR_APPLICATION_ID>”
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Authorization-Provider: husqvarna”
-H “Content-Type: application/vnd.api+json”
-d “{“data”:{“type”:“ParkUntilNextSchedule”}}”

ResumeSchedule:
curl -X POST “https://api.amc.husqvarna.dev/v1/mowers/<MOWER_ID>/actions”
-H “accept: /
-H “X-Api-Key: <YOUR_APPLICATION_ID>”
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Authorization-Provider: husqvarna”
-H “Content-Type: application/vnd.api+json”
-d “{“data”:{“type”:“ResumeSchedule”}}”

Further commands here:

It all works for me nicely and smoothly. But pretty please can someone of you guys make a rule or phtyon script out of it?

Thanks,
Peter

1 Like

I tried the API, using the HTTP Binding. First I got an access token using the command line

curl -X POST -d \ 
"grant_type=password&client_id=<APP KEY>&username=<USERNAME>&password<PASSWORD>" \ 
https://api.authentication.husqvarnagroup.dev/v1/oauth2/token

Then using that access token in an item like this:

Number AutomowerBattery "AutomowerBattery [%d]" <battery> { http="<[https://api.amc.husqvarna.dev/v1/mowers{Authorization=Bearer <ACCESS_TOKEN>&Authorization-Provider=husqvarna&X-Api-Key=<YOUR_APPLICATION_ID>}:60000:JSONPATH($..battery.batteryPercent)]" }

It works fine until the token expires, of course. I haven’t done more than this. I guess the next step could be to manage tokens as described here:
https://community.openhab.org/t/oauth2-using-just-oh-rules-and-myopenhab-org/46680

1 Like

I am currently working on an Automower Binding and want to contribute it once it is working. Not that far yet, just the login working :slight_smile:
I will post an update here once I have something useful

3 Likes

This would be the binding I was talking about: https://github.com/openhab/openhab-addons/pull/8050

It is not yet merged but still a pull request. If someone is interested you can take it from my fork at: https://github.com/maxpg/openhab-addons

1 Like

Hi @markus_pfleger .
Thanks for working on this. I’d be happy to test this. You have a .jar you can upload here?
Thanks.

1 Like

Great, Created Bridge, automower is found, next i have to learn about the commands.

Thanks for your Work

Binding info can be found on his github.

I tried to upload the jar file directly to allow testing without building it locally. Unfortunately I am not sure how to do it without affecting my pull request…

For a documentation regarding commands make sure to have a look at “openhab-addons/bundles/org.openhab.binding.automower/README.md”

2 Likes

@markus_pfleger, installed the build that @Rado1 uploaded, working great so far.
Wondering if you can add a channel for next start time?

1 Like