HA stops reporting Wink state changes

Not sure about long term, but I just swapped out that file and restarted and did a test where everything worked. Changes done through the Wink app were seen in the HA frontend and vice versa. Hopefully this will help with the problem I’ve been facing over the past several days where the motion sensor would get stuck at “off” for hours at a time (even though the Wink app showed the correct state) resulting in the livingroom shutting off all lights and the TV while I was watching it.

1 Like

Sorry I’m late to joining this thread. I updated to 38.2 and ever since then, HA is no longer able to read the state from my Wink Hub 2. I can control wink devices, but HA never reflects the proper state of the devices. I tried the updated pubnubsubhandler.py fix above, but it gives me an invalid config error. Does any one have any ideas on what I should try?

the updated pubnubsubhandler should definitely not give you a config error.

What’s the actual error message? Post it here.

Here are the logged errors:

17-02-14 20:55:10 WARNING (Thread-3) [homeassistant.components.emulated_hue] When targetting Google Home, listening port has to be port 80
17-02-14 20:55:11 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component wink
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 151, in _async_setup_component
    None, component.setup, hass, config)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/wink.py", line 66, in setup
    from pubnubsubhandler import PubNubSubscriptionHandler
  File "/home/homeassistant/.homeassistant/deps/pubnubsubhandler.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax
17-02-14 20:55:19 ERROR (Thread-14) [netdisco.ssdp] Error fetching description at https://192.168.33.163:8888
17-02-14 20:55:21 ERROR (Thread-6) [plexapi] http://192.168.33.139:32400: (401) unauthorized

I think you downloaded the file with HTML tags in it.

Go back to the Github link and look for the little button in the upper right hand marked “Raw”

Right click on that and it should offer to save the file as pubnubsubhandler.py. Save that file and check it in notepad.

The first three lines of the file should be:

"""
Handle the subscriptions responses between PubNub and another program.
"""

Copy that file over and make sure the permissions are correct.

Rookie mistake. You were exactly correct. That completely solved the issue. Thank you!!

1 Like

Works well. Thanks for the fix!!!

BTW, I had to remove self._pnconfig.reconnect_policy = PNReconnectionPolicy.EXPONENTIAL

Feb 14 13:40:55 DietPi hass.sh[2826]: AttributeError: type object ‘PNReconnectionPolicy’ has no attribute ‘EXPONENTIAL’

a little of a beginners question – why did this break suddenly? I do not take any updates. Is Python silently updating the dependency? Can I stop that?

I’ll have to look into that reconnect policy thing, I thought I fixed that. What version of HA are you on? The reason this broke is because wink made a change in their API. Nothing to do with any of our code.

I verified I am not getting that error and that Attribute does exist in pubnub 4.0.5 you must have an older version of pubnub installed?

If only I had looked here / at this post a few days ago. Instead, I assumed it was a change that I had made elsewhere and rebuilt my HASS box from scratch! (I’m embarrassed to say what other things that I did in the process of investigating this before even re-imaging my server.)

Thanks a ton, @w1ll1am23

Don’t feel bad, I did it last weekend. Took me about 4 days to get things running right again.

FWIW I’m running the modified pubnubsubhandler.py and still getting reliable bad syncing

Are you seeing any errors in your logs?

I am also running the modified pubnubsubhandler and things have come to a grinding halt this AM. I am not seeing anything that sticks out in the log files, but have zero syncing this AM. I have 11 Leviton switches, a few cree light bulbs, and gocontrol sensors all linked into Wink.

I made the modification at 10:04 am yesterday and the last event that I got into HA was at 9:22 pm. Next event that should have been logged would have been 6:50 AM when my wife turned on the living room lights.

Not sure if this helps, but I am very interested in having this fixed… lots invested into Wink and HA.

Can you send me your log? And also can you set your logging to debug as described here https://home-assistant.io/components/logger/ then watch for this to happen again and see if you get any errors.

Updated to version 0.38.3 last night and I was getting status of lights from the Wink hub. Now today when I toggle a light it comes on but says its off.

Can you send me your homeassistant.log? Also look a couple comments above and try setting your logging to debug.

ok. What would you like me to log?

Edit: It gets really big if I log everything.

Swapped out the file, and everything seems to be updating again. My motion sensor goes to “unavailable” in the wee hours of the morning, but it’s been doing that forever, so I don’t think it’s related. Other than that, it looks like I’m coming up on 24 hours of reliable status reporting. Thanks!

Just stopped working again. Have about 120mb of logs… when I get infront of my computer I will post them.

1 Like