Automower Binding (G2)

To provide a jar you can create a release on GitHub. On the right side of your openhab-addons repo page in GitHub you can create a release. With a release you can attach binary files. Here you can add the jar file. The url to this jar file contains the release tag name. So if you update the release with a new jar file you can either edit the release or simply removing the release and tag and recreate the release with the same release tag you will always have the same url to point to.

Seems to work with an Automower 330 (running 430 firmware). Great binding, I can now work out a rule to park them when itā€™s heavy rain, wind or snow :smiley:

Confirm here it is working fine as well with my automower 430X. Great stuff :slight_smile:

I also use Location i Habpanel

Hi @markus_pfleger,

just want to give feedback that I was able to run my 430x with that binding too.
Great work, thanks for that! I was looking for this binding very long. Thanks for your work.

I downloaded the jar-file from that dropbox link provided by @Rado1 .
I copied the jar to /usr/share/openhab2/addons and the binding got installed immediately.

Now I do have some questions :slight_smile:

In /var/log/openhab2/openhab.log I can see:

2020-07-13 20:19:17.293 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-13 22:19:17.894 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-14 00:19:18.291 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-14 02:19:18.723 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-14 04:19:19.668 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-14 06:19:20.226 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers
2020-07-14 08:19:21.210 [INFO ] [ndler$AutomowerBridgePollingRunnable] - Found 1 automowers

It is by purpose that Automower will be discovered every 2 hours?
Anyhow, now big deal. Just wondering.

In openhab paperui - control windows I can see the control.
It shows:
Error Code: 0
Error Time 01.01.1970 01:00:00
Does this date&time come from Husqvarna?

And third question: if you update the binding, how would I install the update?
Because the binding is not listed (yet) in the official openhab binding repository the update will be still a manual step, right?
How to do that? Same as installing the binding via jar-file?

And last but not least:
as g_g_rich already mentioned a channel for next start time would be very nice!

Thanks again Markus!

Thanks for the feedback. Actually I am currently trying to get the pull request merged. As it is my first openhab contribution (and actually my first opensource contribution at all) there are quite some things not ideal yet.

The logging will be improved, it checks all 2 hours if the bridge is still available, I do this by checking for the available automowers, the log output will be removed.

The control channels will be replaced by actions.

The error code & date are actually the initial values when there is no error. Not 100% sure if this is from my binding or if it is what Husqvarna gives me. I will try to check if I can change that.

As said, I hope the binding will soon be offical, then you can get updates for that easily.

Did not yet have time for the next start time as I am improving the binding right now to get it approved :wink:

3 Likes

@markus_pfleger i have added next start and some other stuff. I can do a pull request when you have it approved.

/Mike

1 Like

Could someone please check if you get the same error

2020-07-17 22:39:09.995 [WARN ] [ndler$AutomowerBridgePollingRunnable] - Unable to fetch automowers
org.openhab.binding.automower.internal.rest.exceptions.AutomowerCommunicationException: Rest call failed: statusCode=429, message={"message":"Limit Exceeded"}

@Dibbler42

Limits

The following limitations currently apply to the AutomowerĀ® Connect API:

  • Max 1 request per second and appKey .
  • Max 10 000 request per month and appKey .

Any additional requests above these limits will be throttled.

@tnem

To me it sounds like you exceeded the number of rest requests that are allowed by Husqvarna per month.

I think you can place 10000 requests per month. Without sending commands the binding should do the following requests:

Check bridge state:
Default Interval: 1h
ā†’ 24 checks per day, ~720 checks per month

Check automower state (per registered automower):
Default Interval: 10min
ā†’ 144 checks per day, ~4320 checks per month

So with 1 automower the binding should do ~5000 requests per month, meaning there are ~5000 requests remaining for sending commands,ā€¦

Of course with shorter intervals one might reach the limit within the monthā€¦

1 Like

Nice, still waiting for the approval of my PRā€¦

1 Like

Meanwhile i found the limits as well. These should be in the documentation.

@Dibbler42
it is in the documentation of Husqvarna :slight_smile: When you create an account and connect the API you will see the hint, that 10.000 requests/month are allowed. At least I saw it :innocent:

1 Like

Afetr searchin in the API documentaion i found it too, but i meant the Binding documentation :slight_smile:

@markus_pfleger Thanks for making this initial development for an automower binding available! I am one of probably more who created their own solution to retrieve status of Husqvarna mowers and send commands. I did that by implementing a python script featuring command line arguments to trigger a status retrieval and send commands. I call this script using the exec binding. :roll_eyes: Pretty ugly but works.

The issue I have been facing too is about the monthly quota. Assuming commands can be neglected compared to status retrievals, one can issue a status request every 4 minutes. I have chosen 5 minutes to have some contingency and room for commands. This is working without running into the quota, but it is certainly not satisfactory to e.g. track movements and get instant messages on status changes.

An additional issue arises due to the fact I run two mowers (315X and 450X). When retrieving status individually, this allows status retrieval every 9 minutes only. I worked around this by retrieving the status of all mowers using the ā€œhttps://api.amc.husqvarna.dev/v1/mowersā€ end point - which has enough information on status and generates only one call for all mowerā€™s status. I see you use that endpoint too (getMowers()) but use the individual status retrieval (getMower()) for the regular channel updates? Iā€™m sorry if Iā€™m wrong, but want to propose to reconsider using getMowers() only to reduce bandwidth. Another proposal is to allow the configuration of a sleep time to e.g. mute status retrievals over night? I will post this as a feature request on GitHub in parallel.

I have used Husqvarnaā€™s developer program contact to request either a raising of the monthly quota or exclude status retrieval from the quota counting, but havenā€™t heard back since then. I want to ask everyone who registers for the Automower Connect Api to repeat a request like this too. Once they hear there are many wanting this feature, they may start reacting. Thanks to everyone.

Ideally, Iā€™d like to get status updates every 10 secondsā€¦

1 Like

@HarryS1 I agree, I am also not happy with this small quota. I currently use the getMowers() only to check if the bridge is still working and during discovery to find new mowers.
I used this approach as it seemed obvious but I understand the problem with multiple mowers. I have to check the API and what we donā€™t get by the getMowers() call and if this might collide with future features.

What I intended to do (once the initial contribution is through and I have time) was to allow specifying independent query intervals for timeframes within the mower schedule and outside.
Such that I could say outside of the schedule I only check every 30min, while I check every 2min when inside the schedule.

Still, to be honest, for me this would not have that high priority because I figured that I donā€™t really need the state a lot for my automation use cases. I just want to park until further notice when there is a severe weather warning or when I hit a certain wall switch (to park the mower when we go to the garden with our kids without using a mobile app).

1 Like

could you guide me, how to install your update (containing next start time)? :slight_smile:
Thanks in advance,
greets from SĆ¼dhessen.

1 Like

Can you (or anyone) help me with a couple of small questions on your Automower Binding please? Iā€™m relatively new to openhab and still find some syntax very confusing.
I have a 430X mower with Automower connect already fitted.
I have successfully installed your binding, have registered with Husqvarna and obtained an API key, and have it working in openhab showing the activity and status and battery etc.
My questions are: (1) why does the binding documentation show the creation of items related to ā€˜commandsā€™ with channels? There are no such channels listed under the ā€˜automower thingā€™ when I created it. Are these necessary so that I can issue commands to the mower?
(2) What is the exact syntax for issuing a simple ā€˜pauseā€™ command say? Iā€™m confused by the syntax in the example given in the docs. :roll_eyes:
Many thanks if can advise,
regards, Denis

updateā€¦ no replies so had to figure it out myselfā€¦ am able to issue commands after watching a few videos on Java syntax etc.
Still puzzled though why Markusā€™s openhab docs on automower.items show the creation of ā€˜commandā€™ itemsā€¦ deciphering syntax doesnā€™t come easily to me.
bye

Hi @markus_pfleger ,

I am using your binding now for a while - and it is working perfect.
Now I moved my openHAB (2.5.10 stable) from Raspberry to docker (on Synology). I did a backup/restore and everything is working but just automower binding stopped working.

The automower binding reports in paper-ui:

OFFLINE - COMMUNICATION_ERROR Unable to query registered mowers  

Log messages:

[ERROR] [oauth2client.internal.OAuthConnector] - grant type refresh_token to URL    https://api.authentication.husqvarnagroup.dev/v1/oauth2/token failed with error code invalid_grant, description Failed to find token
[WARN ] [ternal.bridge.AutomowerBridgeHandler] - Unable to fetch automowers: Rest call failed: statusCode=-1, message=Unable to authenticate

I checked passwords and IDs over and over again - it is absoulutely the same on Raspi and on Docker. On Raspi it is working fineā€¦but on docker it stopped.
I did for testing a restore to a second Raspberry as well - no issues with connection, binding worked.

I also changed log level for automower to ā€œDEBUGā€

log:list
org.openhab.binding.automower           ā”‚ DEBUG      

ā€¦ but I cannot find or provide more infos out of the Log.

If more info is needed I am happy to send it.

I would like to ask if there are any known issues with docker? I read e.g. that network binding does not support ping-checks anymore. Maybe there is something known with docker as wel?

Thanks in advance, Kai

Hm, thats interesting. I am using the OAuth connector service, so most of it I donā€™t do on my own here. Interesting is that it seems to authenticate with the refresh_tokenā€¦

Did it work initially after the upgrade an stopped working after some time? Or was it never able to connect? Because I think it should use the refresh_token only to refresh it after it expired for the first timeā€¦

I upgraded to 2.5.10 without backup/restore. There it worked without any problemsā€¦