HA stops reporting Wink state changes

Yeah. won’t make a difference, should be the same file but if you forgot it will cause problems later.

Oddly I don’t see the custom_components directory anymore. Could that have been deleted by the update?

Shouldn’t be. Mine never is. In fact I think specifically that installs and updates don’t touch that because some devs use it for testing.

That makes sense. Where did it go. I guess it must have been me. Wow. I’m getting old.

And… it’s back:

17-01-17 08:00:43 homeassistant.components.wink: Error in pubnub JSON for Main Floor Master hub polling API for current state
17-01-17 08:00:44 pubnub: take message interrupted: 'NoneType' object has no attribute 'loop'

That “Main Floor Master” is a pico remote. No one ever uses it. I’ll ask my wife if she used it but I’d be surprised.

I’m checking on status from my office. When I change a light in Wink HASS seems to change it back. Yikes. Wife is gonna be pissed.

Yeah, that’s going to be the case for a bit until @w1ll1am23 gets a chance to update the Wink component as well as getting an answer back from the pubnub guys.

I’ve been working with him on the support (just providing data, not doing any of the ‘heavy lifting’ like he is!) and he’s discovered a lot of things from looking at my JSON output so I think that overall Wink support is going to improve quite a bit once he’s done. One of the things he noticed is that some devices like Relay load buttons and apparently your Pico remote are being improperly read in as hubs.

It’ll be worth the wait.

@kevince52 @rpitera I think I am done with the python-wink work now. I am working on the home-assistant side now. I will test this for a few days probably, but once I am done I will need you guys to test.

There were 122 files changed in the python-wink PR resulting in 6020 lines added and 6495 lines removed. So, less lines of code with more supported devices. This next change should include camera support, remote support, relay button support, sprinkler support, and door bell support.

2 Likes

You know how to reach me - I’ll be glad to test. Thanks for all your hard work!

Edit: Whoa! Just realized 122 file changes; will I be able to test using the custom_components folder? I’m not sure I know how to do it another way.

Yeah I’ll get together a setp by step on what needs done. Its 122 files in python-wink so you won’t need to touch that. Should only be maybe 6 files in homeassistant.

Cool - I’m in. (I mean I would have been in anyway but this makes it less scary!)

I’m in for testing too. Let me know.

I finally was able to recreate this pubnub error which running my new code. Looks like home-assistant is throwing the error.

ERROR:homeassistant.components.wink:Error in pubnub JSON for Spotter loudness 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 "/home/w1ll1am/.virtualenvs/hass_dev/lib/python3.4/site-packages/homeassistant-0.37.0.dev0-py3.4.egg/homeassistant/components/wink.py", line 129, in _pubnub_update
    self.update_ha_state()
  File "/home/w1ll1am/.virtualenvs/hass_dev/lib/python3.4/site-packages/homeassistant-0.37.0.dev0-py3.4.egg/homeassistant/helpers/entity.py", line 191, in update_ha_state
    self.async_update_ha_state(force_refresh), self.hass.loop
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 911, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 859, in run
    self._target(*self._args, **self._kwargs)
  File "/home/w1ll1am/.virtualenvs/hass_dev/config/deps/pubnub/workers.py", line 25, in run
    self._take_message()
  File "/home/w1ll1am/.virtualenvs/hass_dev/config/deps/pubnub/pubnub.py", line 341, in _take_message
    self._process_incoming_payload(msg)
  File "/home/w1ll1am/.virtualenvs/hass_dev/config/deps/pubnub/workers.py", line 85, in _process_incoming_payload
    self._listener_manager.announce_message(pn_message_result)
  File "/home/w1ll1am/.virtualenvs/hass_dev/config/deps/pubnub/managers.py", line 202, in announce_message
    callback.message(self._pubnub, message)
  File "/home/w1ll1am/.virtualenvs/hass_dev/config/deps/pubnubsubhandler.py", line 186, in message
    func(json.loads(json_data))
  File "/home/w1ll1am/.virtualenvs/hass_dev/lib/python3.4/site-packages/homeassistant-0.37.0.dev0-py3.4.egg/homeassistant/components/wink.py", line 133, in _pubnub_update
    self.update_ha_state(True)
  File "/home/w1ll1am/.virtualenvs/hass_dev/lib/python3.4/site-packages/homeassistant-0.37.0.dev0-py3.4.egg/homeassistant/helpers/entity.py", line 191, in update_ha_state
    self.async_update_ha_state(force_refresh), self.hass.loop
AttributeError: 'NoneType' object has no attribute 'loop'

Looks like this is a simple fix, I’ll send out instructions later tonight or tomorrow on how you can make this change now for those of you having the problem.

1 Like

Nice thanks.

@w1ll1am23 sorry i have not done much reading here.

i got the following error today followed by no state changes

17-01-18 02:49:55 pubnub: Exception in subscribe loop: Connection Error: ('Connection aborted.', BadStatusLine("''",))
17-01-18 02:49:55 pubnub: reconnection policy is disabled, please handle reconnection manually.
17-01-18 03:40:34 homeassistant.core: Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1059, in execute_service
service_handler.func(service_call)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/wink.py", line 100, in force_update
entity.update_ha_state(True)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py", line 192, in update_ha_state
).result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 402, in result
return self.__get_result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 354, in __get_result
raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
state = self.state
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/binary_sensor/__init__.py", line 66, in state
return STATE_ON if self.is_on else STATE_OFF
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/binary_sensor/wink.py", line 105, in is_on
return self.wink.state()
  File "/root/.homeassistant/deps/pywink/devices/sensors.py", line 350, in state
return self._last_reading.get('connection', False)
  File "/root/.homeassistant/deps/pywink/devices/base.py", line 41, in _last_reading
return self.json_state.get('last_reading') or {}
AttributeError: 'NoneType' object has no attribute 'get'

Just opened a PR to fix this and the NoneType errors reported above. This error you are seeing is because the pubnub API doc says the reconnection_policy should be set when it fact it should be the reconnect_policy. This is updated in pubnubsub-handler==1.0.0

3 Likes

Knew you’d find it! Thanks man!

If anyone wants to run this now, just place the wink.py from here https://github.com/w1ll1am23/home-assistant/blob/update_pubnubsub-handler/homeassistant/components/wink.py inside your config/custom_component folder.

I’ll test it now.

EDIT: Conveniently I seem to have gotten that error last night!

1 Like

Me too, didn’t realize that the last update didn’t include the version 1.0.0 pubnubsub-handler. It should have gone out with 0.36.0.

Running stable over here - states reporting well and no errors so far!

Great, thanks. Keep me posted.