Wink client_id/client_secret setup isn't working

So that error is coming from the base wink.py not from the one in the custom components. Are you sure that you are using the file found here https://github.com/w1ll1am23/home-assistant/blob/wink_oauth_authorization/homeassistant/components/wink.py

@StarScream159 same thing, based on your error I am pretty sure you have the correct file, but it could have some formatting errors. Can you re-download from the link above and try again?

I samba into my RPI3, inside the HASSBIAN/homeassistant folder i created the custom_components folder then inside the
custom_components folder i place the wink.py then i edit configuration.yaml with wink: then restart homeassistant
I get an error at the home page

Invalid Config
The following components and platforms could not be set up:
wink
Please check your config

Thanks for helping us with this.

This time I viewed the ā€œrawā€ file from github and did a ā€œsave page asā€ then moved the file to the server (instead of doing a copy + paste of the contents in vi).

This is what is in the log now:

Jul 13 10:27:02 centbox scl[26543]: 2017-07-13 10:27:02 INFO (Thread-9) [custom_components.wink] Using new oauth authentication
Jul 13 10:27:02 centbox scl[26543]: 2017-07-13 10:27:02 INFO (Thread-9) [homeassistant.loader] Loaded configurator from homeassistant.components.configurator
Jul 13 10:27:02 centbox scl[26543]: 2017-07-13 10:27:02 ERROR (MainThread) [homeassistant.setup] Error during setup of component wink
Jul 13 10:27:02 centbox scl[26543]: Traceback (most recent call last):
Jul 13 10:27:02 centbox scl[26543]: File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 190, in _async_setup_component
Jul 13 10:27:02 centbox scl[26543]: component.setup, hass, processed_config)
Jul 13 10:27:02 centbox scl[26543]: File "/opt/rh/rh-python35/root/usr/lib64/python3.5/asyncio/futures.py", line 358, in __iter__
Jul 13 10:27:02 centbox scl[26543]: yield self  # This tells Task to wait for completion.
Jul 13 10:27:02 centbox scl[26543]: File "/opt/rh/rh-python35/root/usr/lib64/python3.5/asyncio/tasks.py", line 290, in _wakeup
Jul 13 10:27:02 centbox scl[26543]: future.result()
Jul 13 10:27:02 centbox scl[26543]: File "/opt/rh/rh-python35/root/usr/lib64/python3.5/asyncio/futures.py", line 274, in result
Jul 13 10:27:02 centbox scl[26543]: raise self._exception
Jul 13 10:27:02 centbox scl[26543]: File "/opt/rh/rh-python35/root/usr/lib64/python3.5/concurrent/futures/thread.py", line 55, in run
Jul 13 10:27:02 centbox scl[26543]: result = self.fn(*self.args, **self.kwargs)
Jul 13 10:27:02 centbox scl[26543]: File "/opt/homeassistant/custom_components/wink.py", line 228, in setup
Jul 13 10:27:02 centbox scl[26543]: _request_app_setup(hass, config)
Jul 13 10:27:02 centbox scl[26543]: File "/opt/homeassistant/custom_components/wink.py", line 148, in _request_app_setup
Jul 13 10:27:02 centbox scl[26543]: 'type': 'string'}]
Jul 13 10:27:02 centbox scl[26543]: File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/components/configurator.py", line 52, in request_config
Jul 13 10:27:02 centbox scl[26543]: request_id = instance.request_config(
Jul 13 10:27:02 centbox scl[26543]: AttributeError: 'bool' object has no attribute 'request_config'
Jul 13 10:27:02 centbox scl[26543]: 2017-07-13 10:27:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=title=Invalid config, message=The following components and platforms could not be set up:
Jul 13 10:27:02 centbox scl[26543]: * [wink](https://home-assistant.io/components/wink/)
Jul 13 10:27:02 centbox scl[26543]: Please check your config, notification_id=invalid_config, service_call_id=139889918886464-1, domain=persistent_notification, service=create>
Jul 13 10:27:02 centbox scl[26543]: 2017-07-13 10:27:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
Jul 13 10:27:02 centbox scl[26543]: * [wink](https://home-assistant.io/components/wink/)
Jul 13 10:27:02 centbox scl[26543]: Please check your config; title=Invalid config @ 2017-07-13T10:27:02.466192-04:00>, old_state=None, entity_id=persistent_notification.invalid_config>

I am running this with python3.4 so maybe it is an issue with python3.5? I will have to try this when I get home. I know there are a few other people running this without issue so I am not sure what is going on.

Also, what version of HA are you running?

O, and another thing. This error is coming from the configurator not from wink.py so I guess it is possible something is different in the version of HA you are running.

Oh yeah maybe. Okay, hereā€™s my version numbers:

CentOS Linux release 7.3.1611 (Core)
Python 3.5.1 (in virtualenv)
Home Assistant v 0.48.1
Wink Hub 2 Firmware: 3.8.1-0-gaa5707514d-hub2-app

Other version information:

(homeassistant)[root@centbox homeassistant]# pip3 install --upgrade homeassistant
Requirement already up-to-date: homeassistant in ./lib/python3.5/site-packages
Requirement already up-to-date: pyyaml<4,>=3.11 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: async-timeout==1.2.1 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pytz>=2017.02 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: typing<4,>=3 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: aiohttp==2.2.0 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: chardet==3.0.2 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: requests==2.14.2 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.9.5 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: voluptuous==0.10.5 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pip>=7.1.0 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: astral==1.4 in ./lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: multidict>=2.1.4 in ./lib/python3.5/site-packages (from aiohttp==2.2.0->homeassistant)
Requirement already up-to-date: yarl<0.11,>=0.10.0 in ./lib/python3.5/site-packages (from aiohttp==2.2.0->homeassistant)
Requirement already up-to-date: MarkupSafe>=0.23 in ./lib/python3.5/site-packages (from jinja2>=2.9.5->homeassistant)

I was thinking. Iā€™ve had a hard time getting Home Assitant working in general. I had a lot of problems with dependencies not installing and throwing errors when starting. So Iā€™m manually had to install a few. I know I had a hard time getting pubnubsub-handler/pubnub installed. So could it be something to do with the version of my dependencies?

Also, Iā€™d like to add that even if I remove the OAUTH stuff and just use my email/password, I still get a ton of errors in my log related to Wink. (This was when I was using the non-custom component py file.) However, even with the errors, on the States page it didnā€™t say there was a problem with Wink (like a configuration error). But none of my lights/switches showed up anywhere. (Doesnā€™t help that I donā€™t really understand how to add the lights/switches. I thought it was auto.)

EDIT: Actually, I just tried it again to get you a log of what I see with just email/password & the non-custom component py file and it worked fine. I even see my lights/swtiches on the States page now. SUUUPPPER weird.

Im running the latest Hassbian RPI image

Python 3.4.2
Home Assistant
0.48.1

I was able to reproduce your error when running 0.48.1 but canā€™t in 0.49 (dev) there must have been a change to the configurator between 0.48 and now, so unfortunately you wonā€™t be able to run this. Sorry.

So you will not be able to use your client_id/secret until 0.49 is release (as long as this new wink.py gets added PR is still open waiting review)

While you wait you should be able to revert to username/password config and run that.

1 Like

I was able to reproduce your error as well, but only when running 0.48.1 without adding the wink.py to the custom_component directory. It sounds like it isnā€™t picking up the file. However this doesnā€™t matter because like I told @StarScream159 you will not be able to use this version of the wink.py

Sorry for leading you both to believe this would work, I wasnā€™t aware there were changes to the configurator.

You should be able to use username/password to authenticate for now.

Okay, thanks so much for all the debugging. I will revert back to username/password for now and wait for the next release.

1 Like

Hi Everyone,

I see a new version was released, I upgraded but am still faced with the ā€œ401 Response from Wink API. Maybe Bearer token is expired?ā€ response when I attempt to use my API creds to connect to Wink.

Anyone else get it to work on the new version?

Sorry, it didnā€™t make it in to 0.49 it was merged into dev late last week, it will be included in the next release 0.50

2 Likes

Okay, thanks for letting me know! Thanks for your prompt reply!

is the wink auth working when i go to auth/wink it just stalls with spinning circle?

Are you performing the auth from the same local network as your HA box? What is the full URL you are trying to access?

Iā€™m trying to set this up and ran into the same issue. On the Developer Page I set my base URL as https://hass.externaldomain.com which I already have redirects set up to handle the port and whatnot. In the redirect URI I put https://192.168.1.5:8123/auth/wink/callback.

After I tried to set it up it keeps telling me to authorize wink by going to https://www.externaldomain.com/auth/wink , which I know wonā€™t work. So I saw this post and changed my base URL to the local IP.

However, I am still getting the external domain address when I try to configure Wink. I am guessing that it takes a bit to update on the Wink end of things? Did you have to wait?

Hmm I still get a ā€œRedirect URI is not authorizedā€ error when I go to https://192.168.1.5:8123/auth/wink .

Here is how I have the Wink Developer App setup:

Iā€™m getting the feeling there is something stupid staring me in the face and I canā€™t quite figure it out.

Edit: The second redirect URI was added after testing to see if it would help. It didnā€™t.

Remove the second uri and make sure you are performing the initial setup on the same network 192.168.1.x

When you configure wink it will always say that external address if that is where you are accessing it, no way around it. Just hit the IP when it tells you to use the URL.

1 Like

Ok. Finally got it working.

After I removed the 2nd entry I tried again and got the same error. However, this time I noticed that in the api.wink.com redirect url that comes up it was still trying to use the external domain address without a port. So I manually changed that URL in the address bar to have it point to the local address. Once I did that it was able to sign in and authorize.

Iā€™m not sure where it pulls that redirect URL from but it didnā€™t forget it even when I cleared history and dns.

Anyway. Thanks for the help folks!

Thanks so much for this. Mine had almost the same problem. My URL that came up as the external address with a port, but it still would not work. Once I edited the URL to replace the external address with my internal IP address it worked.

A bit of a noob, but having similar issues. When i go to 192.168.x.xx:8123/auth/wink/callback

I get No Code Returned From Wink API
Iā€™ve tried multiple browsers on multiple PCā€™s. Kind of pulling my hair out.
Any advice is appreciated.