I don’t have the script anymore, but all it did was turn on and then off a light every hour. Could be worth a shot to see what it does.
I’m having similar issues. HA stops reporting state changes/communicating with the Wink hub after a while until HA is restarted.
Nothing shows up in the error log related to Wink. However, I did start seeing these errors recently:
17-02-21 10:00:39 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on SSL transport
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/selector_events.py", line 825, in _read_ready
data = self._sock.recv(self.max_size)
File "/usr/lib/python3.4/ssl.py", line 730, in recv
return self.read(buflen)
File "/usr/lib/python3.4/ssl.py", line 619, in read
v = self._sslobj.read(len or 1024)
OSError: [Errno 113] No route to host
Not sure if that’s Wink related or something else. Could be my Chromecast since it powers down when the TV turns off, but I don’t recall seeing it in the past for my Chromecast, and that stack trace has been in my log every time I’ve lost the ability to communicate with my Wink hub from HA.
Add me to the list of people having issues. I created a test environment of HA with only the Wink hub and a notification component added. I then added an automation to turn on a light every 30 min, wait 10 seconds, send a notification with the status of the light as shown in HA, then turn off the light. Log is attached. Remove “yaml” from end. A few things to note from this test.
home-assistant.log.yaml (1.3 MB)
- I added email address, password, client secret, and client ID for the Wink component
- The issue seems to appear at 6 hours after HA is started
- After the notification started showing the state did not change for the light, I went into the Wink iPhone app and toggled a light. This seems to reset the 6 hour window and the state changes start working again.
- Started HA at 10:31 PM. State changes were working as of the 4:30 AM automation trigger. The 5:00AM state change did not work. Around 5:50 I went into the Wink App and toggled a light. The 6:00AM automation did show the correct state.
- Looking at the logs, right after the 4:30 automation is triggered, there is a GET/GOT from Pubnub. The 5:00 automation does not have this.
Not sure if any of this is useful, but hopefully @w1ll1am23 can make something of it. Appreciate all the work being put into sorting out this issue so far.
I, too am having issues like what @shire210 has described, although I’m not running any kind of test environment. I just know that things will work for a while, and then state changes stop being reported in HA.
This is helpful, thanks. Not sure how to fix it but its a starting point. So, can you do me a favor? Next time it happens don’t toggle a state change in the wink app, just open the app (force close it first if it was already open) and see if states start working again.
Sure thing. I just started up the test environment again. Check back again in about 7 hours and I should hopefully have an update for you.
Awesome, just to clarify because I think what I said above may have been a little unclear. Once HA gets into this state, open your official Wink app and let it finish syncing. Once that is done, toggle a state in HA and make sure it then shows the correct state.
Understood. Makes perfect sense. Looking to see if just opening the app is enough to jump start the state refreshing in HA.
I know others have mentioned before, but just confirming it is also happening in my testing… The state does not update but The lights will still turn on/off with the toggle. It is only the state that is not updating.
Also, I have a Schlage lock connected through Wink that has a sensor that turns on and off when a certain code is entered. Thought it was worth mentioning that it is not only light states that are affected, but any device connected through Wink.
My Wink stopped updating again this morning, so I did what you asked, w1ll1am23.
- I tried toggling a light in HA which was showing as off even though it was on. State wouldn’t change.
- I opened the Wink app and just let it sit there for a few seconds.
- I tried toggling the same light and HA immediately reflected the correct state.
Seems like the Wink app does something to the hub that gets it going again.
I dont know whether this will be of any use but I’ll offer it anyway - I’m also willing to do some testing as directed by others…
My Wink setup is a bit unusual in that I don’t have a hub but I do have a Canary. The only way of being able to control the Canary in HA is to set it up via wink (they have a very closed API and only integrate with wink).
I’m having a very similar issue with device state not updating after approx the first six hours of a restart. If I, through the dev console, manually call wink/refresh_state it will update but in the interim there’s clearly something not quite right…
Please let me know if you think this is totally unrelated (in which case I’ll report it elsewhere) but otherwise, willing to help in any way I can.
Awesome, thanks! So I feel like this issue started happening when pubnub added support for presence detection. This is a message that is fired over the pubnub connection any time a “new” connection to the subscription key is made.
I found a quote from a pubnub email I received on January 27th.
“Subscribe / Presence / Status messages are now coming through the global callbacks”
This use to be an optional thing pubnub offered that Wink would have had to pay for to use. They started offering it for free.
So, here is the next test. Does receiving that presence message “fix” the reporting of states.
If someone can get into this state again maybe @shire210? Go to this site https://www.pubnub.com/docs/console and input your subscribe key and a channel. (You can get this from your device JSON from Wink@home) get this prior to getting into the state because wink@home will create a presence message when you log in. You should see the presence message pop up in your HA logs. Then see if states start updating again. If this works I will have to figure out a way to either unsubscribe and then resubscribe or kick off another subscription every hour or something to keep things running.
I just pulled my device JSON from Wink@home. Does it matter which channel I use ex: Hub, Lightbulb?
States are still updating for now in test environment. I will try this once they stop responding.
It shouldn’t matter, as long as you are using a channel for a device that HA has.
Apologies. I must be doing something wrong. I tried the above and it says there was an error. I Added the error below. I replaced The Sub Key, channel, and UUID to remove personal information.
Thu Feb 23 2017 21:50:58:073 : [ “PUBLISH ERROR”, { “error”: true, “operation”: “PNPublishOperation”, “statusCode”: 400, “errorData”: { “original”: null, “response”: { “req”: { “method”: “GET”, “url”: “https://ps6.pubnub.com/publish/demo/Sub Key/0/channel/0/%7B%22text%22%3A%22hey%22%7D?meta=%7B%7D&uuid=UUID&pnsdk=PubNub-JS-Web%2F4.3.2”, “headers”: {} }, “xhr”: {}, “text”: “[0,"Invalid Key","14879046602328100"]”, “statusText”: “INVALID”, “statusCode”: 400, “status”: 400, “statusType”: 4, “info”: false, “ok”: false, “clientError”: true, “serverError”: false, “error”: { “status”: 400, “method”: “GET”, “url”: “https://ps6.pubnub.com/publish/demo/Sub Key/0/channel/0/%7B%22text%22%3A%22hey%22%7D?meta=%7B%7D&uuid=UUID&pnsdk=PubNub-JS-Web%2F4.3.2” }, “accepted”: false, “noContent”: false, “badRequest”: true, “unauthorized”: false, “notAcceptable”: false, “notFound”: false, “forbidden”: false, “headers”: { “cache-control”: “no-cache”, “content-type”: “text/javascript; charset="UTF-8"” }, “header”: { “cache-control”: “no-cache”, “content-type”: “text/javascript; charset="UTF-8"” }, “type”: “text/javascript”, “charset”: “"UTF-8"”, “body”: null }, “status”: 400 }, “category”: “PNBadRequestCategory” } ]
Thu Feb 23 2017 21:50:58:050 : [ “PUBLISHING TO”, “channel” ]
Thu Feb 23 2017 21:50:55:086 : [ “CONNECTED TO”, “channel” ]>
Another update, When the automation in HA runs, the Pubnub site does show activity:
Thu Feb 23 2017 22:59:59:789 : “{"capabilities":{},"created_at":1483124753,"desired_state":{"powered":true},"device_manufacturer":"ge","gang_id":null,"hidden_at":null,"hub_id":"471531","icon_code":"light_bulb-eti_bulb","icon_id":"56","last_reading":{"brightness":0.69,"brightness_changed_at":1487907023.6558766,"brightness_updated_at":1487907037.649185,"connection":true,"connection_updated_at":1487907037.649185,"desired_brightness_changed_at":1487903230.1399934,"desired_brightness_updated_at":1487907154.152699,"desired_powered":true,"desired_powered_changed_at":1487908800.7274818,"desired_powered_updated_at":1487908800.7274818,"powered":false,"powered_changed_at":1487907037.649185,"powered_updated_at":1487907037.649185},"lat_lng":[lat long],"light_bulb_id":"2331463","linked_service_id":null,"local_id":"2","locale":"en_us","location":"location","manufacturer_device_id":null,"manufacturer_device_model":"ge_jasco_dimmer_in_wall","model_name":"In-Wall Smart Dimmer","name":"Kitchen","object_id":"2331463","object_type":"light_bulb","order":0,"radio_type":"zwave","subscription":{"pubnub":{"channel":"Channel","subscribe_key":"Sub Key"}},"triggers":,"units":{},"upc_code":"ge_jasco-dimmer-in-wall","upc_id":"668","user_ids":["520021"],"uuid":"UUID","nonce":"99464244"}”
In the first “log” it looks like you tried to publish to the channel not subscribe to it. In the second “log” everything looks good, so based on that, the HA instance of the pubnub connection should have seen a presence message. Did the state in your test HA start showing correctly after you subscribed in the pubnub console?
Ok. I understand it now. No, the test HA did not start showing correctly after I subscribed. I reset everything and left the developer console running overnight. the console stopped updating the same time HA stopped reporting the state correctly. I unsubscribed and resubscribed in the console, but now I am still not getting any updates.
This is very similar to the original problem we were having way back when this thread was started. The solution then was to hit the Wink API every hour, maybe that isn’t enough? Do you know how to make a request to the Wink API? If so can you try that and see if states start working then?
Basically you need to make a GET request to https://api.wink.com/users/me/wink_devices with the following two headers
content-type: application/json
Authorization: Bearer YOUR_TOKEN_HERE
This is exactly what is happening when you see this
17-02-23 23:30:17 INFO (Thread-25) [pubnubsubhandler] Polling the API
In your logs. Do you see this in your logs?
Hi w1ll1am23,
I’m seeing the presence notifications in my HA logs even the wink status in HA is not showing correct.
17-02-24 06:00:46 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:05:25 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:10:06 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:14:45 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:19:25 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:24:06 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:28:46 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:33:26 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:38:05 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:42:45 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:47:26 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:52:06 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 06:56:46 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 07:01:26 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
17-02-24 07:06:06 DEBUG (EndpointThread-Heartbeat-0) [pubnub] GOT {“status”: 200, “message”: “OK”, “service”: “Presence”}
I only see the Polling the API in the HA log every hour even when the wink status is not showing correct.
17-02-24 05:01:19 INFO (Thread-596) [pubnubsubhandler] Polling the API
17-02-24 06:01:19 INFO (Thread-610) [pubnubsubhandler] Polling the API
17-02-24 07:01:19 INFO (Thread-624) [pubnubsubhandler] Polling the API
I logged into wink@home and PubNub around 6:45 am
I will leave the PubNub Developer Console open and monitor the log.
Anyone running in Linux that can run the following to output there stderr and stdout to a file? I just found a bug that would cause this problem (although it isn’t even in dev yet so it can’t be causing the problem we are seeing) It doesn’t show up in the normal logs though.
sudo journalctl -u hass.service > ~/hass.service.log
Of course you will need to change the hass.service to whatever your systemd service name is.
Once you have that log you should be able to search for “Traceback” to find errors
Can someone try this for me when the problem occurs. I want to see if you are having the same problem as me, or if it’s a different issue. Try going to a different HA view tab and see if everything responds over there ok? In my case, it’s only the main tab that doesn’t work. All my other tabs work fine. I went so far as to build a view of all of my components and even though my main tab is screwed up, the new view works fine.