Automower Binding (G2)

Is anyone else having problem to connect the bridge?

I get this error

2021-06-23 23:50:47.250 [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
2021-06-23 23:50:47.258 [WARN ] [ternal.bridge.AutomowerBridgeHandler] - Unable to fetch automowers: Rest call failed: statusCode=-1, message=Unable to authenticate

Hi Michael,

I am having the same problem (“Unable to authenticate”). I got my Automower only very recently, so I initially set it up 2 days ago.

The funny thing is that it worked at first. The Bridge Thing was online and I was able to discover the Automower as well. Everything worked.

Today, the bridge is offline and I can’t get it to work anymore. I’ve reset everything and created a new app key in the Husqvarna developer portal, double-checked the password and app key several times. Nothing helps. The terminal test works fine.

I am hoping for a solution.

PS: I am on openHAB 3.0.1

I got it working again.

This time, I set it up via the Main UI. That worked immediately. However, I still can’t get it working using text files.

I also got it working.
I had to skip file configuration and rename bridge from mybridge.

Hi there,

The new channel planner-next-start (added in OH 3.1)
doesn’t output the correct time. It always shows +2 hours. All other DateTime channels output the correct time.

Does anyone know how to fix (or re-calculate) this?

Thanks!

Hi @markus_pfleger,
thanks for your contribution - much appreciated!
I just realized by accident that the JSON with a mower’s data as returned from the Husqvarna API actually contains a list of waypoints (latitude + longitude). I was wondering if you planned to integrate this in your binding? I think it would be very nice to visualize the mower’s position in a map :smiley:
Thanks,
Bernhard

Hello Bernhard,
I have tested the reading of the GPS data. The last 50 positions are always saved. Thereby a new position is added internally in the Automower approx. every 20 seconds and the last one is deleted for this. Unfortunately, there is no time information per position, so that a correct display is not possible. With TrackMap, however, the path traveled can be roughly displayed quite well in e.g. Grafana.
As a further problem, the coordinates or the GPS map of the Automower are probably offset by 15m.

No, I have no plans in that direction as I see no use case for me. It doesn’t help me to automate and in visualizations I am not so much interested :wink: (and if I would be really interested I would just use the automower app).

But happy about any contributions if someone finds that useful…

Hi Sven,
thanks for your reply. I saw that the waypoints don’t have a timestamp, but thought simply updating the position in the map with the latest waypoint would suffice to at least give a good indication where the mower is currently working. But now thinking about it, that would create an issue with too many requests against the very limited quota… otherwise, after say 5 minutes the position will be rather useless.

However, there might still be an intersting usecase: my Automower keeps falling over (over the edge and down a slope, emergency stop because it drove under the trampoline ladder, …). So this way I could at least get a hint where to go to fix the problem :smiley:

Thanks for the heads-up! Maybe at some point I’ll take a look at it and come up with a suggestion :grinning:

Maybe a solution is to retrieve the position if an error occurs. So we should get into any limits and get a hint where to search in case of an error

I think always retrieving the position would automatically let you know the last position when an error occurs, so no additional logic would be required; and we could simply discard the retrieved positions if they are only required for locating the device.

I didn’t look into the logic behind the array of waypoints but assuming they are recorded in certain time intervals would also provide a pretty neat coverage over possibly longer timeframes (as required by the quota of API requests).
Maybe I should simply tape a mobile phone with GPS to the mower at some point and match a separate GPS tracking to the output of a few API requests while the mower is active… this might also provide some practical data to determine the deviation from the actual position.

2 Likes

Actually I did take a stab at it and it seems to work fine so far.
I’ve actually added now 50 channels for all waypoints.

If anyone is interested the changes are available here: GitHub - bern77/openhab-addons at bern77-gps

I’m also happy to share the JAR.

1 Like

Hi,
thanks for doing this enhancements! :grinning:
Can you share how you display the waypoints? My Items are empty.
That’s how I try to implement the Waypoint.

String      AutomowerWayPoint1  "Waypoint 1 [%s]"   <movecontrol>   (Automower, DB) { channel="automower:automower:mybridge2:myAutomower:position01" }

Happy for your suggestions!

br. Christian

Please use Location as the item type, then it should work.

1 Like

And in the channel please use positions#position01

1 Like

Hello bern77,

thanks for your help!!! :smiley: Working great!

Does anyone have a suggestion how to display the way, indicated by the waypoints?

Br. Christian

Hello Christian,
the Grafana PlugIn TrackMap can do this. But for this you need latitude and longitude separately. With openhab an influxdb the location is stored as a comma separated value.
Perhaps there is a suitable query that extracts latitude or longitude from the stored coordinates. Unfortunately, I have not yet been able to do this with the help of the documentation.
A few ideas regarding path visualization can be found here.

Does anyone have an idea or solution for openhab, influxdb and TrackMap?

I get this from the binding now and then.

2021-08-26 15:50:34.394 [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
2021-08-26 15:50:34.400 [WARN ] [ternal.bridge.AutomowerBridgeHandler] - Unable to fetch automowers: Rest call failed: statusCode=-1, message=Unable to authenticate

Only way to fix it is to delete the thing and recreate it with a new identifier.

What can this be?