HA stops reporting Wink state changes

You solved the Relay issue too. I just remembered that and tripped both buttons and nothing in the logs!

EDIT: Hang on - just realized I was in the middle of a restart. Let me check again once I am fully back up.

Hopefully it is fixed, I think what I did resolved the NoneType error you were getting before.

Whoops. Got this on my restart - not sure why as I didnā€™t get it the first time.

17-01-18 12:40:26 homeassistant.bootstrap: Error during setup of component wink
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
    conn.connect()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 323, in connect
    ssl_context=context)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/lib/python3.4/ssl.py", line 577, in __init__
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 624, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/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/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/wink.py", line 83, in setup
    pywink.get_subscription_key(),
  File "/home/hass/deps/pywink/api.py", line 194, in get_subscription_key
    response_dict = wink_api_fetch()
  File "/home/hass/deps/pywink/api.py", line 208, in wink_api_fetch
    response = requests.get(arequest_url, headers=API_HEADERS)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:600)

Whatā€™s weird is that I have lost my cameras as well, which are not Wink devices.

I just reverted my cameras.yaml - which I was editing and was the reason for a second restart - and I am restarting again. I donā€™t know how the two could be related, but the first restart with the new wink.py went fine and that was the only thing I changed after that.

EDIT:

No idea what changing my camera friendly names to lower case did and how that in any way could generate the errors FROM WINK, but reverting back to my original file and restarting solved everything.

HUH WHUT?!?!

I see that SSL error sometimes on restart. I think I have it fixed in the new python-wink update I am working on. I believe the reason is because during stratup the wink api is polled for every device and it starts timing out. The update caches the first request to prevent this.

Donā€™t think the changes you made did anything, think it was just luck.

But why Wink errors and nothing from the cameras? If the error was with Wink, the cameras still should have initialized on their own; their not Wink based cams.

Whatā€™s more, when I went to their empty view, the Wink persistent notification was on that view as well - and there is nothing in that view except cameras.

Two of the names of the cameras I was going to use had ā€˜/ā€™ slashes in the names; perhaps the input wasnā€™t sanitized?

Iā€™m going to try one more restart. Lower case names, but no slashes.

I wasnā€™t changing the friendly names. I WAS CHANGING THE NAMES.

Iā€™m an idiot.

They werenā€™t showing up because I changed the device names and never updated the group. The persistent error message was probably in ALL my views but I only looked at Default and the cameras view.

The error was indeed just a coincidence. Sorry to fire off the alarms without checking my workā€¦

No problem, glad its working.

Still feel dumb as a post.

Sad news is that I just hit my Relay top load button and got this:

17-01-18 17:24:04 homeassistant.components.wink: Error in pubnub JSON for Wink Relay's Top Button hub polling API for current state
17-01-18 17:24:05 pubnub: take message interrupted: 'NoneType' object has no attribute 'loop'

So it looks like that error is still in play. Sorry.

Can you confirm that your wink.py in the custom components has this on line 115

self.hass = hass

If it is there, can you try changing the python-wink==0.12.0 at the top of the file to python-wink==0.13.0 that should skip over the relay buttons and the remotes. python-wink==1.0.0 which is the new version I am working on supports these two device properly and should stop this from happening. Just trying to temporarily fix it for you guys.

OK, confirmed line 115. Made change to python-wink==0.13.0 and am now restarting.

Edit: Nope. Still able to generate the error.

So far so good for me. No errors with my remotes. Wink running smoothly and all updates being pushed to HASS.

So confusing. Can you try something for me? Run hass in the foreground and try to generate the error again. When I was able to recreate, running in the foreground provided me with a much more detailed error message.

This makes me want to but a relay just so I can figure this out lol.

Iā€™ll see if I can do this at some point during the day.

Another observation is that once I generated this error, Wink stopped updating states throughout. Woke up this morning and HA showed my lights still on and door unlocked although everything was off and locked.

It looks like as long as I donā€™t use the Relay, Iā€™m fine.

EDIT: Embarrassed to admit it, but I canā€™t figure out how to run it in the foreground. Would running with logs in debug suffice or can you show me how to run in foreground?

Iā€™ve been lurking on this issue and have a Wink Relay myself. I think I have the logs you need:

ERROR:homeassistant.components.wink:Error in pubnub JSON for Wink Relay's Top Button hub polling API for current state
ERROR:pubnub:take message interrupted: 'NoneType' object has no attribute 'loop'
Exception in thread SubscribeMessageWorker:
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/wink.py", line 129, in _pubnub_update
self.update_ha_state()
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 192, in update_ha_state
).result()
AttributeError: 'NoneType' object has no attribute 'loop'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
  File "/home/homeassistant/.homeassistant/deps/pubnub/workers.py", line 25, in run
self._take_message()
  File "/home/homeassistant/.homeassistant/deps/pubnub/pubnub.py", line 341, in _take_message
self._process_incoming_payload(msg)
  File "/home/homeassistant/.homeassistant/deps/pubnub/workers.py", line 85, in _process_incoming_payload
self._listener_manager.announce_message(pn_message_result)
  File "/home/homeassistant/.homeassistant/deps/pubnub/managers.py", line 202, in announce_message
callback.message(self._pubnub, message)
  File "/home/homeassistant/.homeassistant/deps/pubnubsubhandler.py", line 185, in message
func(json.loads(json_data))
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/wink.py", line 133, in _pubnub_update
self.update_ha_state(True)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 192, in update_ha_state
).result()
AttributeError: 'NoneType' object has no attribute 'loop'

Hope that helps!

1 Like

Sweet! Think I might have found it. Looks like I have a typo in the binary_sensor/wink.py doing a quick test now and I will push my change to the open PR I have.

The reason I thought I fixed it before was because I was having the issue on a sensor/wink.py device and not a binary_sensor/wink.py the typo in the binary_sensor/wink.py was preventing the change I made from taking effect.

Really this should all go way once I move to python-wink 1.0.0 since the relay buttons wont mistakenly get pulled in as binary_sensor.

@TeNpoLe21 @rpitera can you try this. custom_components/binary_sensor/wink.py using this file https://github.com/w1ll1am23/home-assistant/blob/update_pubnubsub-handler/homeassistant/components/binary_sensor/wink.py

Restarting now.

Damn. Still there.

17-01-19 12:06:16 homeassistant.components.wink: Error in pubnub JSON for Wink Relay's Top Button hub polling API for current state
17-01-19 12:06:16 pubnub: take message interrupted: 'NoneType' object has no attribute 'loop'

Going to set logs for debug and restart.

Same here, error still persists.