{"action":"created","comment":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/91344554","pull_request_review_id":11853673,"id":91344554,"diff_hunk":"@@ -0,0 +1,65 @@\n+\"\"\"\n+Support for Tellstick switches using Tellstick Net.\n+\n+This platform uses the Telldus Live online service.\n+\n+For more details about this platform, please refer to the documentation at\n+https://home-assistant.io/components/light.tellduslive/\n+\n+\"\"\"\n+import logging\n+\n+from homeassistant.components.tellduslive import (\n+    TelldusLiveEntity,\n+    TELLSTICK_TURNON,\n+    TELLSTICK_TURNOFF,\n+    TELLSTICK_DIM)\n+from homeassistant.components.light import (\n+    Light,\n+    ATTR_BRIGHTNESS,\n+    SUPPORT_BRIGHTNESS)\n+\n+_LOGGER = logging.getLogger(__name__)\n+\n+\n+def setup_platform(hass, config, add_devices, discovery_info=None):\n+    \"\"\"Setup lights.\"\"\"\n+    if discovery_info is None:\n+        return\n+    add_devices(TelldusLiveLight(hass, light) for light in discovery_info)\n+\n+\n+class TelldusLiveLight(TelldusLiveEntity, Light):\n+    \"\"\"Representation of a light.\"\"\"\n+\n+    @property\n+    def brightness(self):\n+        \"\"\"Return the brightness of this light between 0..255.\"\"\"\n+        try:\n+            return int(self._device.get(\"statevalue\"))\n+        except ValueError:\n+            return 255\n+\n+    @property\n+    def supported_features(self):\n+        \"\"\"Flag supported features.\"\"\"\n+        return SUPPORT_BRIGHTNESS\n+\n+    @property\n+    def is_on(self):\n+        \"\"\"Return true if light is on.\"\"\"\n+        # pylint: disable=attribute-defined-outside-init\n+        self._brightness = self.brightness  # remember last set brightness\n+        return (self._state == TELLSTICK_TURNON or\n+                self._state == TELLSTICK_DIM)\n+\n+    def turn_on(self, **kwargs):\n+        \"\"\"Turn the light on.\"\"\"\n+        level = kwargs.get(ATTR_BRIGHTNESS, self._brightness)\n+        if self._execute(TELLSTICK_DIM, level=level):\n+            self._device['statevalue'] = level\n+            self.update_ha_state()\n+\n+    def turn_off(self, **kwargs):\n+        \"\"\"Turn the light off.\"\"\"\n+        self._execute(TELLSTICK_TURNOFF)","path":"homeassistant/components/light/tellduslive.py","position":65,"original_position":65,"commit_id":"0825979b7afe4a70005e8a2f136b044829a47ea7","original_commit_id":"0825979b7afe4a70005e8a2f136b044829a47ea7","user":{"login":"molobrakos","id":8228319,"avatar_url":"https://avatars.githubusercontent.com/u/8228319?v=3","gravatar_id":"","url":"https://api.github.com/users/molobrakos","html_url":"https://github.com/molobrakos","followers_url":"https://api.github.com/users/molobrakos/followers","following_url":"https://api.github.com/users/molobrakos/following{/other_user}","gists_url":"https://api.github.com/users/molobrakos/gists{/gist_id}","starred_url":"https://api.github.com/users/molobrakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobrakos/subscriptions","organizations_url":"https://api.github.com/users/molobrakos/orgs","repos_url":"https://api.github.com/users/molobrakos/repos","events_url":"https://api.github.com/users/molobrakos/events{/privacy}","received_events_url":"https://api.github.com/users/molobrakos/received_events","type":"User","site_admin":false},"body":"The state is updated in the parent class (`TelldusLiveDevice`), which also overrides `should_poll` to return `False`.","created_at":"2016-12-07T17:34:35Z","updated_at":"2016-12-07T17:34:36Z","html_url":"https://github.com/home-assistant/home-assistant/pull/4645#discussion_r91344554","pull_request_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645","_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/91344554"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/4645#discussion_r91344554"},"pull_request":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645"}}},"pull_request":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645","id":95922420,"html_url":"https://github.com/home-assistant/home-assistant/pull/4645","diff_url":"https://github.com/home-assistant/home-assistant/pull/4645.diff","patch_url":"https://github.com/home-assistant/home-assistant/pull/4645.patch","issue_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/4645","number":4645,"state":"open","locked":false,"title":"Telldus Live: Implement support for covers and dimmable lights + some refactoring","user":{"login":"molobrakos","id":8228319,"avatar_url":"https://avatars.githubusercontent.com/u/8228319?v=3","gravatar_id":"","url":"https://api.github.com/users/molobrakos","html_url":"https://github.com/molobrakos","followers_url":"https://api.github.com/users/molobrakos/followers","following_url":"https://api.github.com/users/molobrakos/following{/other_user}","gists_url":"https://api.github.com/users/molobrakos/gists{/gist_id}","starred_url":"https://api.github.com/users/molobrakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobrakos/subscriptions","organizations_url":"https://api.github.com/users/molobrakos/orgs","repos_url":"https://api.github.com/users/molobrakos/repos","events_url":"https://api.github.com/users/molobrakos/events{/privacy}","received_events_url":"https://api.github.com/users/molobrakos/received_events","type":"User","site_admin":false},"body":"**Description:**\r\n\r\n- Implement support for covers and dimmable lights\r\n- Use hass.data instead of global reference\r\n- Disabled polling in entities\r\n- Inherit from common TelldusLiveEntity\r\n- Configurable polling interval\r\n- Use HTTPS API endpoint instead of HTTP \r\n- Replaces the dependency telcore-py with requests-oauth, since only the oauth stuff and the tellcore constants were used from the library anyway\r\n\r\n**Related issue (if applicable):** fixes #<home-assistant issue number goes here>\r\nhttps://community.home-assistant.io/t/trying-to-expand-tellduslive-support/3369/16\r\n\r\n**Pull request in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io) with documentation (if applicable):** home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>\r\n\r\n**Example entry for `configuration.yaml` (if applicable):**\r\n```yaml\r\n\r\n```\r\n\r\n**Checklist:**\r\n\r\nIf user exposed functionality or configuration variables are added/changed:\r\n  - [ ] Documentation added/updated in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io)\r\n\r\nIf the code communicates with devices, web services, or third-party tools:\r\n  - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**\r\n  - [ ] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]).\r\n  - [ ] New dependencies are only imported inside functions that use them ([example][ex-import]).\r\n  - [ ] New dependencies have been added to `requirements_all.txt` by running `script/gen_requirements_all.py`.\r\n  - [ ] New files were added to `.coveragerc`.\r\n\r\nIf the code does not interact with devices:\r\n  - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**\r\n  - [ ] Tests have been added to verify that the new code works.\r\n\r\n[ex-requir]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L16\r\n[ex-import]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L51\r\n\r\n","created_at":"2016-11-30T16:16:06Z","updated_at":"2016-12-07T17:34:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38534c8077068d005ee72a66873553ddf89948f4","assignee":{"login":"balloob","id":1444314,"avatar_url":"https://avatars.githubusercontent.com/u/1444314?v=3","gravatar_id":"","url":"https://api.github.com/users/balloob","html_url":"https://github.com/balloob","followers_url":"https://api.github.com/users/balloob/followers","following_url":"https://api.github.com/users/balloob/following{/other_user}","gists_url":"https://api.github.com/users/balloob/gists{/gist_id}","starred_url":"https://api.github.com/users/balloob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balloob/subscriptions","organizations_url":"https://api.github.com/users/balloob/orgs","repos_url":"https://api.github.com/users/balloob/repos","events_url":"https://api.github.com/users/balloob/events{/privacy}","received_events_url":"https://api.github.com/users/balloob/received_events","type":"User","site_admin":false},"assignees":[{"login":"balloob","id":1444314,"avatar_url":"https://avatars.githubusercontent.com/u/1444314?v=3","gravatar_id":"","url":"https://api.github.com/users/balloob","html_url":"https://github.com/balloob","followers_url":"https://api.github.com/users/balloob/followers","following_url":"https://api.github.com/users/balloob/following{/other_user}","gists_url":"https://api.github.com/users/balloob/gists{/gist_id}","starred_url":"https://api.github.com/users/balloob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balloob/subscriptions","organizations_url":"https://api.github.com/users/balloob/orgs","repos_url":"https://api.github.com/users/balloob/repos","events_url":"https://api.github.com/users/balloob/events{/privacy}","received_events_url":"https://api.github.com/users/balloob/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645/commits","review_comments_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645/comments","review_comment_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/4645/comments","statuses_url":"https://api.github.com/repos/home-assistant/home-assistant/statuses/0825979b7afe4a70005e8a2f136b044829a47ea7","head":{"label":"molobrakos:tellduslive2","ref":"tellduslive2","sha":"0825979b7afe4a70005e8a2f136b044829a47ea7","user":{"login":"molobrakos","id":8228319,"avatar_url":"https://avatars.githubusercontent.com/u/8228319?v=3","gravatar_id":"","url":"https://api.github.com/users/molobrakos","html_url":"https://github.com/molobrakos","followers_url":"https://api.github.com/users/molobrakos/followers","following_url":"https://api.github.com/users/molobrakos/following{/other_user}","gists_url":"https://api.github.com/users/molobrakos/gists{/gist_id}","starred_url":"https://api.github.com/users/molobrakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobrakos/subscriptions","organizations_url":"https://api.github.com/users/molobrakos/orgs","repos_url":"https://api.github.com/users/molobrakos/repos","events_url":"https://api.github.com/users/molobrakos/events{/privacy}","received_events_url":"https://api.github.com/users/molobrakos/received_events","type":"User","site_admin":false},"repo":{"id":48067711,"name":"home-assistant","full_name":"molobrakos/home-assistant","owner":{"login":"molobrakos","id":8228319,"avatar_url":"https://avatars.githubusercontent.com/u/8228319?v=3","gravatar_id":"","url":"https://api.github.com/users/molobrakos","html_url":"https://github.com/molobrakos","followers_url":"https://api.github.com/users/molobrakos/followers","following_url":"https://api.github.com/users/molobrakos/following{/other_user}","gists_url":"https://api.github.com/users/molobrakos/gists{/gist_id}","starred_url":"https://api.github.com/users/molobrakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/molobrakos/subscriptions","organizations_url":"https://api.github.com/users/molobrakos/orgs","repos_url":"https://api.github.com/users/molobrakos/repos","events_url":"https://api.github.com/users/molobrakos/events{/privacy}","received_events_url":"https://api.github.com/users/molobrakos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/molobrakos/home-assistant","description":"Open-source home automation platform running on Python 3","fork":true,"url":"https://api.github.com/repos/molobrakos/home-assistant","forks_url":"https://api.github.com/repos/molobrakos/home-assistant/forks","keys_url":"https://api.github.com/repos/molobrakos/home-assistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/molobrakos/home-assistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/molobrakos/home-assistant/teams","hooks_url":"https://api.github.com/repos/molobrakos/home-assistant/hooks","issue_events_url":"https://api.github.com/repos/molobrakos/home-assistant/issues/events{/number}","events_url":"https://api.github.com/repos/molobrakos/home-assistant/events","assignees_url":"https://api.github.com/repos/molobrakos/home-assistant/assignees{/user}","branches_url":"https://api.github.com/repos/molobrakos/home-assistant/branches{/branch}","tags_url":"https://api.github.com/repos/molobrakos/home-assistant/tags","blobs_url":"https://api.github.com/repos/molobrakos/home-assistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/molobrakos/home-assistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/molobrakos/home-assistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/molobrakos/home-assistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/molobrakos/home-assistant/statuses/{sha}","languages_url":"https://api.github.com/repos/molobrakos/home-assistant/languages","stargazers_url":"https://api.github.com/repos/molobrakos/home-assistant/stargazers","contributors_url":"https://api.github.com/repos/molobrakos/home-assistant/contributors","subscribers_url":"https://api.github.com/repos/molobrakos/home-assistant/subscribers","subscription_url":"https://api.github.com/repos/molobrakos/home-assistant/subscription","commits_url":"https://api.github.com/repos/molobrakos/home-assistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/molobrakos/home-assistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/molobrakos/home-assistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/molobrakos/home-assistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/molobrakos/home-assistant/contents/{+path}","compare_url":"https://api.github.com/repos/molobrakos/home-assistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/molobrakos/home-assistant/merges","archive_url":"https://api.github.com/repos/molobrakos/home-assistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/molobrakos/home-assistant/downloads","issues_url":"https://api.github.com/repos/molobrakos/home-assistant/issues{/number}","pulls_url":"https://api.github.com/repos/molobrakos/home-assistant/pulls{/number}","milestones_url":"https://api.github.com/repos/molobrakos/home-assistant/milestones{/number}","notifications_url":"https://api.github.com/repos/molobrakos/home-assistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/molobrakos/home-assistant/labels{/name}","releases_url":"https://api.github.com/repos/molobrakos/home-assistant/releases{/id}","deployments_url":"https://api.github.com/repos/molobrakos/home-assistant/deployments","created_at":"2015-12-15T20:38:36Z","updated_at":"2016-09-26T12:37:36Z","pushed_at":"2016-12-06T15:42:39Z","git_url":"git://github.com/molobrakos/home-assistant.git","ssh_url":"git@github.com:molobrakos/home-assistant.git","clone_url":"https://github.com/molobrakos/home-assistant.git","svn_url":"https://github.com/molobrakos/home-assistant","homepage":"https://home-assistant.io","size":44341,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"home-assistant:dev","ref":"dev","sha":"76ff934bd34cb04cf3a028add2a7d6bb572b565f","user":{"login":"home-assistant","id":13844975,"avatar_url":"https://avatars.githubusercontent.com/u/13844975?v=3","gravatar_id":"","url":"https://api.github.com/users/home-assistant","html_url":"https://github.com/home-assistant","followers_url":"https://api.github.com/users/home-assistant/followers","following_url":"https://api.github.com/users/home-assistant/following{/other_user}","gists_url":"https://api.github.com/users/home-assistant/gists{/gist_id}","starred_url":"https://api.github.com/users/home-assistant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/home-assistant/subscriptions","organizations_url":"https://api.github.com/users/home-assistant/orgs","repos_url":"https://api.github.com/users/home-assistant/repos","events_url":"https://api.github.com/users/home-assistant/events{/privacy}","received_events_url":"https://api.github.com/users/home-assistant/received_events","type":"Organization","site_admin":false},"repo":{"id":12888993,"name":"home-assistant","full_name":"home-assistant/home-assistant","owner":{"login":"home-assistant","id":13844975,"avatar_url":"https://avatars.githubusercontent.com/u/13844975?v=3","gravatar_id":"","url":"https://api.github.com/users/home-assistant","html_url":"https://github.com/home-assistant","followers_url":"https://api.github.com/users/home-assistant/followers","following_url":"https://api.github.com/users/home-assistant/following{/other_user}","gists_url":"https://api.github.com/users/home-assistant/gists{/gist_id}","starred_url":"https://api.github.com/users/home-assistant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/home-assistant/subscriptions","organizations_url":"https://api.github.com/users/home-assistant/orgs","repos_url":"https://api.github.com/users/home-assistant/repos","events_url":"https://api.github.com/users/home-assistant/events{/privacy}","received_events_url":"https://api.github.com/users/home-assistant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/home-assistant/home-assistant","description":":house_with_garden: Open-source home automation platform running on Python 3","fork":false,"url":"https://api.github.com/repos/home-assistant/home-assistant","forks_url":"https://api.github.com/repos/home-assistant/home-assistant/forks","keys_url":"https://api.github.com/repos/home-assistant/home-assistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/home-assistant/home-assistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/home-assistant/home-assistant/teams","hooks_url":"https://api.github.com/repos/home-assistant/home-assistant/hooks","issue_events_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/events{/number}","events_url":"https://api.github.com/repos/home-assistant/home-assistant/events","assignees_url":"https://api.github.com/repos/home-assistant/home-assistant/assignees{/user}","branches_url":"https://api.github.com/repos/home-assistant/home-assistant/branches{/branch}","tags_url":"https://api.github.com/repos/home-assistant/home-assistant/tags","blobs_url":"https://api.github.com/repos/home-assistant/home-assistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/home-assistant/home-assistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/home-assistant/home-assistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/home-assistant/home-assistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/home-assistant/home-assistant/statuses/{sha}","languages_url":"https://api.github.com/repos/home-assistant/home-assistant/languages","stargazers_url":"https://api.github.com/repos/home-assistant/home-assistant/stargazers","contributors_url":"https://api.github.com/repos/home-assistant/home-assistant/contributors","subscribers_url":"https://api.github.com/repos/home-assistant/home-assistant/subscribers","subscription_url":"https://api.github.com/repos/home-assistant/home-assistant/subscription","commits_url":"https://api.github.com/repos/home-assistant/home-assistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/home-assistant/home-assistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/home-assistant/home-assistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/home-assistant/home-assistant/contents/{+path}","compare_url":"https://api.github.com/repos/home-assistant/home-assistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/home-assistant/home-assistant/merges","archive_url":"https://api.github.com/repos/home-assistant/home-assistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/home-assistant/home-assistant/downloads","issues_url":"https://api.github.com/repos/home-assistant/home-assistant/issues{/number}","pulls_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls{/number}","milestones_url":"https://api.github.com/repos/home-assistant/home-assistant/milestones{/number}","notifications_url":"https://api.github.com/repos/home-assistant/home-assistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/home-assistant/home-assistant/labels{/name}","releases_url":"https://api.github.com/repos/home-assistant/home-assistant/releases{/id}","deployments_url":"https://api.github.com/repos/home-assistant/home-assistant/deployments","created_at":"2013-09-17T07:29:48Z","updated_at":"2016-12-07T14:41:44Z","pushed_at":"2016-12-07T16:37:35Z","git_url":"git://github.com/home-assistant/home-assistant.git","ssh_url":"git@github.com:home-assistant/home-assistant.git","clone_url":"https://github.com/home-assistant/home-assistant.git","svn_url":"https://github.com/home-assistant/home-assistant","homepage":"https://home-assistant.io","size":89536,"stargazers_count":4940,"watchers_count":4940,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1294,"mirror_url":null,"open_issues_count":326,"forks":1294,"open_issues":326,"watchers":4940,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/4645"},"issue":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/4645"},"comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/4645/comments"},"review_comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645/comments"},"review_comment":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/4645/commits"},"statuses":{"href":"https://api.github.com/repos/home-assistant/home-assistant/statuses/0825979b7afe4a70005e8a2f136b044829a47ea7"}}}}
{"actor":{"display_login":"molobrakos"}}