hi question wink access token we input in the configuration file… do we need to change it often or one time setup… does wink change the the token like monthly or weekly or whatever… if yes do we need to change it inthe configuration file ?
I don’t think so, I’ve been running almost a month now without any problems.
I’ve had to change it periodically…seems like every couple months or so. You’ll know when all your lights stop responding. Just copy and paste the new token into the config file.
Thanks man, I wasn’t aware of that. Saved me a lot of head scratching at some point in the future.
Same here, I’ve had to update it once since I started using HA with wink a couple months ago.
What about using the refresh token, client_id, client_secret and what not available from http://docs.wink.apiary.io/ ?
I use that to regenerate my access token, but would love to leverage the refresh ability brewed into the refresh token.
Anyone else doing that?
How do you know when the access token needs to be refreshed? Is there a specific error message?
Sorry for the delay… I don’t think that this forum sends emails or messages for replies to threads in which you participate.
In regards to a specific error message, I know there is one, but I have rebuilt my database since the last time this expired. The way I know that it has expired is simply that none of my automations fire. So then I go in and check to see if Wink is up. If it is, then I go straight to HASS and check to see if it is hitting the wink api. If not, then I go to http://docs.wink.apiary.io/ and refresh my token manually. I then have to copy and paste it in the config.yaml and relaunch the HASS service. Tedious for sure. If we could leverage the refresh token, that would be the best!
To note, I just checked out the python-nest library that this is built upon (https://github.com/python-wink/python-wink/blob/master/src/pywink/api.py), and it appears that those fields are indeed written in. I will spend some time trying this out tonight. I won’t really know if it works until a token expiration occurs though so remind me to come back and update the thread some time next month or the month after!
Will do and thanks very much for all the information!
So my token expired last night and the added bits did not regenerate a new access token. Looking through the code for python-wink, it DOES look like they should, but I don’t see any documentation for how to add them to the configuration.yaml correctly.
If I find anything, or get this working, I will come back and update the thread to pass on the info.
There’s a pull request for a different method of integrating the Wink hub - you may want to check it out:
Oath2 client_id and client_secret support was added with this PR
Thanks for your hard work on this @w1ll1am23! Just to confirm, as of what release was this merged?
This was added in 0.30
Thanks - I thought so but I just wanted it on the thread so it could be found by others as well. Again, much thanks for your Wink additions to HA code!
Not a problem, definitely better than dealing with expired tokens.
I emailed Wink as soon as I wrote that and am anxiously awaiting my creds!
I started with the second method of just my username and password while Wink was setting up my client id and secret but then it stopped working after a week or so. I then started using the 3rd method once I heard back from Wink but it still won’t work. Any ideas?
Here’s the log to show what’s failing:
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/homeassistant/components/wink.py", line 101, in setup
pywink.get_subscription_key(),
File “/Users/mediacenter/.homeassistant/deps/pywink/api.py”, line 246, in get_subscription_key
response_dict = wink_api_fetch()
File “/Users/mediacenter/.homeassistant/deps/pywink/api.py”, line 265, in wink_api_fetch
raise WinkAPIException(“401 Response from Wink API. Maybe Bearer token is expired?”)
pywink.api.WinkAPIException: 401 Response from Wink API. Maybe Bearer token is expired
So you are using
email
Password
Client id
Client secret
In your config? Nothing else correct? It sounds like your don’t have something in the config correctly, I am assuming your password?