tnemrap
(Michael Parment)
February 8, 2019, 8:53am
1
I am planning to create a binding for Husqvarna AutoMover as my second binding.
I will look at https://github.com/chrisz/pyhusmow
It seems that it uses Token based authorization.
Is there any other binding that uses this where i can look.
I am still struggling with learning Java
/Mike
hilbrand
(Hilbrand Bouwkamp)
February 8, 2019, 9:11am
2
Do you know which protocol? OAuth2? or something custom?
tnemrap
(Michael Parment)
February 8, 2019, 9:24am
3
Seems in pyton that you post username and password and receive token informattion.
def login(self, login, password):
response = self.session.post(self._API_IM + 'token',
headers=self._HEADERS,
json={
"data": {
"attributes": {
"password": password,
"username": login
},
"type": "token"
}
})
response.raise_for_status()
self.logger.info('Logged in successfully')
json = response.json()
self.set_token(json["data"]["id"], json["data"]["attributes"]["provider"])
return json["data"]["attributes"]["expires_in"]
/mike
hilbrand
(Hilbrand Bouwkamp)
February 8, 2019, 9:42am
4
I don’t know what protocol that is. It looks custom and simple. There is probably no standard support out-of-the-box for it. So you need to implement something yourself. Using HttpUtil
you should be able to get the token and store it in some cache. For some inspiration look this earlier Spotify api implementation. It’s based on OAuth2. The earlier implementation had OAuth2 implemented, but current PR uses the OAuth2 implementation part of openHAB. To give you an example here is the token cache handling:
https://github.com/Hilbrand/openhab2-addons/blob/spotify_2.4.0/addons/binding/org.openhab.binding.spotify/src/main/java/org/openhab/binding/spotify/internal/oauth2/SpotifyAccessTokenCache.java
Just browser there to other files too and copy what you can use. Hope this helps somewhat.
tnemrap
(Michael Parment)
February 8, 2019, 3:48pm
5
Thanks now i have somewhere to start.
/Mike
Rado1
(Levi)
April 20, 2019, 5:51pm
6
Hello,
Do you have a test version already?
I will be happy to test it?
tnemrap
(Michael Parment)
April 21, 2019, 3:36pm
7
Not yet still struggling with token based login in java.
/mike
Marfi
(Martin)
April 5, 2020, 8:45pm
8
Hi Michael,
Do you know that there is an open API for Husqvarna Automower?
Regards
Martin
tnemrap
(Michael Parment)
April 6, 2020, 10:56am
9
I Know but was hoping this should happen
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 I will post a new thread as soon something is ready to test.
/Mike
HaKuNa
(Remo M)
April 6, 2020, 11:08am
10
I started but with slow progress. Then I realized the API does not provide position coordianes (which is possible via the husmov solution). Means, atm I do not continue with the binding. But I hope the API will be expanded and will provide more data in the future. Until then I decided to live with the current solution.
tnemrap
(Michael Parment)
April 6, 2020, 2:27pm
11
@HaKuNa Can you share the source?
/Mike