{"action":"created","issue":{"url":"https://api.github.com/repos/python-wink/python-wink/issues/30","repository_url":"https://api.github.com/repos/python-wink/python-wink","labels_url":"https://api.github.com/repos/python-wink/python-wink/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/python-wink/python-wink/issues/30/comments","events_url":"https://api.github.com/repos/python-wink/python-wink/issues/30/events","html_url":"https://github.com/python-wink/python-wink/pull/30","id":144033948,"number":30,"title":"Subscription support","user":{"login":"w1ll1am23","id":6432770,"avatar_url":"https://avatars.githubusercontent.com/u/6432770?v=3","gravatar_id":"","url":"https://api.github.com/users/w1ll1am23","html_url":"https://github.com/w1ll1am23","followers_url":"https://api.github.com/users/w1ll1am23/followers","following_url":"https://api.github.com/users/w1ll1am23/following{/other_user}","gists_url":"https://api.github.com/users/w1ll1am23/gists{/gist_id}","starred_url":"https://api.github.com/users/w1ll1am23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w1ll1am23/subscriptions","organizations_url":"https://api.github.com/users/w1ll1am23/orgs","repos_url":"https://api.github.com/users/w1ll1am23/repos","events_url":"https://api.github.com/users/w1ll1am23/events{/privacy}","received_events_url":"https://api.github.com/users/w1ll1am23/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-28T17:34:50Z","updated_at":"2016-06-17T23:01:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/python-wink/python-wink/pulls/30","html_url":"https://github.com/python-wink/python-wink/pull/30","diff_url":"https://github.com/python-wink/python-wink/pull/30.diff","patch_url":"https://github.com/python-wink/python-wink/pull/30.patch"},"body":"This PR does 2 things. \r\n1. It adds the ability to pull the subscription key and channel from the initial API query when calling get_devices.\r\n2. It adds support for updating each devices json_state from the data returned form the Pubnub API. For the most part the data returned follows the Wink API.\r\n\r\nThree things to note.\r\n1.  Powerstrips needed some tweaking since the Wink API and the Pubnub API treat it as 1 device but we treat it as 2 (1 for each outlet).\r\n2. Spotter humidity is returned as a float in the Pubnub API and not an int like it is in the Wink API. To account for this a check was added to see if humidity was less than 1.0 if so convert to an int. (works unless the humidity is less than 1% which I doubt will happen (don't think it has ever happened any where in the world from a quick Google search))\r\n3. These updates allow for subscription based updates as well as polling updates. Subscription updates will only work when using a token obtained with the Android or iOS client secret and client id. I have a support ticket open with Wink to request subscription keys to be returned in all API requests. It is possible this will never happen of course.\r\n\r\nI received the latest update below from Wink on getting subscription details added to all API responses.\r\n\r\n> Hi William,\r\n\r\n>Victoria here from Wink support. Thanks for reaching out to us. We've identified the issur you're running into and are close to implementing a fix. Once that fix has been pushed out, you'll get the subscription objects you want. I have been assured that this will be very soon. Let me know if you have any other questions or concerns. Thanks!\r\n\r\n>Cheers, \r\n>Victoria\r\n\r\nI contacted Wink at the end of last week 4-22-16 . They stated they are still working on this issue and weren't able to provide a date for the fix. I will continue to check the API and get this PR up-to-date once their fix is in place.\r\n\r\nSupport was added today! This PR should be fully functional. I have been running this since the PR was opened and haven't run into any issues."},"comment":{"url":"https://api.github.com/repos/python-wink/python-wink/issues/comments/226900954","html_url":"https://github.com/python-wink/python-wink/pull/30#issuecomment-226900954","issue_url":"https://api.github.com/repos/python-wink/python-wink/issues/30","id":226900954,"user":{"login":"bradsk88","id":2147630,"avatar_url":"https://avatars.githubusercontent.com/u/2147630?v=3","gravatar_id":"","url":"https://api.github.com/users/bradsk88","html_url":"https://github.com/bradsk88","followers_url":"https://api.github.com/users/bradsk88/followers","following_url":"https://api.github.com/users/bradsk88/following{/other_user}","gists_url":"https://api.github.com/users/bradsk88/gists{/gist_id}","starred_url":"https://api.github.com/users/bradsk88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradsk88/subscriptions","organizations_url":"https://api.github.com/users/bradsk88/orgs","repos_url":"https://api.github.com/users/bradsk88/repos","events_url":"https://api.github.com/users/bradsk88/events{/privacy}","received_events_url":"https://api.github.com/users/bradsk88/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T23:01:15Z","updated_at":"2016-06-17T23:01:15Z","body":"Looks good! :dolphin: :+1: "}}
{"actor":{"display_login":"bradsk88"}}