{"action":"created","comment":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/216118996","pull_request_review_id":153541523,"id":216118996,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjExODk5Ng==","diff_hunk":"@@ -66,6 +68,36 @@\n EVENT_BUTTON_OFF = 'insteon.button_off'\n EVENT_CONF_BUTTON = 'button'\n \n+\n+# Adapted from:\n+# https://github.com/alecthomas/voluptuous/issues/115#issuecomment-144464666\n+def set_default_port() -> Callable:\n+    \"\"\"Set the default port based on the Hub version.\"\"\"\n+    def set_default(obj: Dict) -> Dict:\n+        \"\"\"Set ip_port default value based on hub_version.\"\"\"\n+        if not isinstance(obj, dict):\n+            raise vol.Invalid('expected dictionary')\n+\n+        try:\n+            # If the ip_port is found do nothing\n+            # If it is not found (KeyError) the set the default\n+            ip_port = obj[CONF_IP_PORT]","path":"homeassistant/components/insteon/__init__.py","position":47,"original_position":47,"commit_id":"043860c0e86835baa3508cc6deae8edf160c2488","original_commit_id":"043860c0e86835baa3508cc6deae8edf160c2488","user":{"login":"MartinHjelmare","id":3181692,"node_id":"MDQ6VXNlcjMxODE2OTI=","avatar_url":"https://avatars0.githubusercontent.com/u/3181692?v=4","gravatar_id":"","url":"https://api.github.com/users/MartinHjelmare","html_url":"https://github.com/MartinHjelmare","followers_url":"https://api.github.com/users/MartinHjelmare/followers","following_url":"https://api.github.com/users/MartinHjelmare/following{/other_user}","gists_url":"https://api.github.com/users/MartinHjelmare/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinHjelmare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinHjelmare/subscriptions","organizations_url":"https://api.github.com/users/MartinHjelmare/orgs","repos_url":"https://api.github.com/users/MartinHjelmare/repos","events_url":"https://api.github.com/users/MartinHjelmare/events{/privacy}","received_events_url":"https://api.github.com/users/MartinHjelmare/received_events","type":"User","site_admin":false},"body":"Use `dict.get`.\r\n```py\r\nip_port = obj.get(CONF_IP_PORT)\r\nif ip_port is None:\r\n    hub_version = obj[CONF_HUB_VERSION]\r\n    if hub_version == 1:\r\n        obj[CONF_IP_PORT] = 9761\r\n    else:\r\n        obj[CONF_IP_PORT] = 25105\r\nreturn obj\r\n```","created_at":"2018-09-08T03:08:44Z","updated_at":"2018-09-08T03:10:50Z","html_url":"https://github.com/home-assistant/home-assistant/pull/16472#discussion_r216118996","pull_request_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/216118996"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/16472#discussion_r216118996"},"pull_request":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472"}}},"pull_request":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472","id":213800220,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzODAwMjIw","html_url":"https://github.com/home-assistant/home-assistant/pull/16472","diff_url":"https://github.com/home-assistant/home-assistant/pull/16472.diff","patch_url":"https://github.com/home-assistant/home-assistant/pull/16472.patch","issue_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/16472","number":16472,"state":"open","locked":false,"title":"Fix Hub v1 support","user":{"login":"teharris1","id":9055260,"node_id":"MDQ6VXNlcjkwNTUyNjA=","avatar_url":"https://avatars1.githubusercontent.com/u/9055260?v=4","gravatar_id":"","url":"https://api.github.com/users/teharris1","html_url":"https://github.com/teharris1","followers_url":"https://api.github.com/users/teharris1/followers","following_url":"https://api.github.com/users/teharris1/following{/other_user}","gists_url":"https://api.github.com/users/teharris1/gists{/gist_id}","starred_url":"https://api.github.com/users/teharris1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teharris1/subscriptions","organizations_url":"https://api.github.com/users/teharris1/orgs","repos_url":"https://api.github.com/users/teharris1/repos","events_url":"https://api.github.com/users/teharris1/events{/privacy}","received_events_url":"https://api.github.com/users/teharris1/received_events","type":"User","site_admin":false},"body":"## Description:\r\nWhen insteon_local and insteon_plm were merged, support for the Insteon Hub version 1 is broken. This fixes that support.\r\n\r\n**Related issue (if applicable):** fixes #16342 \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#6211\r\n\r\n## Example entry for `configuration.yaml` (if applicable):\r\n```yaml\r\n# Hub 2242 configuration variables\r\ninsteon:\r\n  host: HOST\r\n  ip_port: IP_PORT\r\n  hub_version: 1\r\n```\r\n\r\n## Checklist:\r\n  - [x] The code change is tested and works locally.\r\n  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**\r\n\r\nIf user exposed functionality or configuration variables are added/changed:\r\n  - [x] 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  - [x] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]).\r\n  - [x] New dependencies are only imported inside functions that use them ([example][ex-import]).\r\n  - [x] New or updated 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  - [ ] 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#L14\r\n[ex-import]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L54\r\n","created_at":"2018-09-07T02:32:56Z","updated_at":"2018-09-08T03:10:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7d7b79cdd023c4c4f0430bb84bf444ade8a6535","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":527871105,"node_id":"MDU6TGFiZWw1Mjc4NzExMDU=","url":"https://api.github.com/repos/home-assistant/home-assistant/labels/cla-signed","name":"cla-signed","color":"008000","default":false},{"id":1036285490,"node_id":"MDU6TGFiZWwxMDM2Mjg1NDkw","url":"https://api.github.com/repos/home-assistant/home-assistant/labels/component:%20insteon","name":"component: insteon","color":"ededed","default":false},{"id":955422305,"node_id":"MDU6TGFiZWw5NTU0MjIzMDU=","url":"https://api.github.com/repos/home-assistant/home-assistant/labels/in%20progress","name":"in progress","color":"ededed","default":false},{"id":832964196,"node_id":"MDU6TGFiZWw4MzI5NjQxOTY=","url":"https://api.github.com/repos/home-assistant/home-assistant/labels/small-pr","name":"small-pr","color":"e5bd7e","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472/commits","review_comments_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472/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/16472/comments","statuses_url":"https://api.github.com/repos/home-assistant/home-assistant/statuses/043860c0e86835baa3508cc6deae8edf160c2488","head":{"label":"teharris1:HubV1","ref":"HubV1","sha":"043860c0e86835baa3508cc6deae8edf160c2488","user":{"login":"teharris1","id":9055260,"node_id":"MDQ6VXNlcjkwNTUyNjA=","avatar_url":"https://avatars1.githubusercontent.com/u/9055260?v=4","gravatar_id":"","url":"https://api.github.com/users/teharris1","html_url":"https://github.com/teharris1","followers_url":"https://api.github.com/users/teharris1/followers","following_url":"https://api.github.com/users/teharris1/following{/other_user}","gists_url":"https://api.github.com/users/teharris1/gists{/gist_id}","starred_url":"https://api.github.com/users/teharris1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teharris1/subscriptions","organizations_url":"https://api.github.com/users/teharris1/orgs","repos_url":"https://api.github.com/users/teharris1/repos","events_url":"https://api.github.com/users/teharris1/events{/privacy}","received_events_url":"https://api.github.com/users/teharris1/received_events","type":"User","site_admin":false},"repo":{"id":133261752,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMyNjE3NTI=","name":"home-assistant","full_name":"teharris1/home-assistant","owner":{"login":"teharris1","id":9055260,"node_id":"MDQ6VXNlcjkwNTUyNjA=","avatar_url":"https://avatars1.githubusercontent.com/u/9055260?v=4","gravatar_id":"","url":"https://api.github.com/users/teharris1","html_url":"https://github.com/teharris1","followers_url":"https://api.github.com/users/teharris1/followers","following_url":"https://api.github.com/users/teharris1/following{/other_user}","gists_url":"https://api.github.com/users/teharris1/gists{/gist_id}","starred_url":"https://api.github.com/users/teharris1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teharris1/subscriptions","organizations_url":"https://api.github.com/users/teharris1/orgs","repos_url":"https://api.github.com/users/teharris1/repos","events_url":"https://api.github.com/users/teharris1/events{/privacy}","received_events_url":"https://api.github.com/users/teharris1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/teharris1/home-assistant","description":":house_with_garden: Open-source home automation platform running on Python 3","fork":true,"url":"https://api.github.com/repos/teharris1/home-assistant","forks_url":"https://api.github.com/repos/teharris1/home-assistant/forks","keys_url":"https://api.github.com/repos/teharris1/home-assistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teharris1/home-assistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teharris1/home-assistant/teams","hooks_url":"https://api.github.com/repos/teharris1/home-assistant/hooks","issue_events_url":"https://api.github.com/repos/teharris1/home-assistant/issues/events{/number}","events_url":"https://api.github.com/repos/teharris1/home-assistant/events","assignees_url":"https://api.github.com/repos/teharris1/home-assistant/assignees{/user}","branches_url":"https://api.github.com/repos/teharris1/home-assistant/branches{/branch}","tags_url":"https://api.github.com/repos/teharris1/home-assistant/tags","blobs_url":"https://api.github.com/repos/teharris1/home-assistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teharris1/home-assistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teharris1/home-assistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/teharris1/home-assistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teharris1/home-assistant/statuses/{sha}","languages_url":"https://api.github.com/repos/teharris1/home-assistant/languages","stargazers_url":"https://api.github.com/repos/teharris1/home-assistant/stargazers","contributors_url":"https://api.github.com/repos/teharris1/home-assistant/contributors","subscribers_url":"https://api.github.com/repos/teharris1/home-assistant/subscribers","subscription_url":"https://api.github.com/repos/teharris1/home-assistant/subscription","commits_url":"https://api.github.com/repos/teharris1/home-assistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/teharris1/home-assistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/teharris1/home-assistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/teharris1/home-assistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/teharris1/home-assistant/contents/{+path}","compare_url":"https://api.github.com/repos/teharris1/home-assistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teharris1/home-assistant/merges","archive_url":"https://api.github.com/repos/teharris1/home-assistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teharris1/home-assistant/downloads","issues_url":"https://api.github.com/repos/teharris1/home-assistant/issues{/number}","pulls_url":"https://api.github.com/repos/teharris1/home-assistant/pulls{/number}","milestones_url":"https://api.github.com/repos/teharris1/home-assistant/milestones{/number}","notifications_url":"https://api.github.com/repos/teharris1/home-assistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teharris1/home-assistant/labels{/name}","releases_url":"https://api.github.com/repos/teharris1/home-assistant/releases{/id}","deployments_url":"https://api.github.com/repos/teharris1/home-assistant/deployments","created_at":"2018-05-13T18:00:55Z","updated_at":"2018-08-22T15:18:54Z","pushed_at":"2018-09-08T02:50:34Z","git_url":"git://github.com/teharris1/home-assistant.git","ssh_url":"git@github.com:teharris1/home-assistant.git","clone_url":"https://github.com/teharris1/home-assistant.git","svn_url":"https://github.com/teharris1/home-assistant","homepage":"https://home-assistant.io","size":87973,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"dev"}},"base":{"label":"home-assistant:dev","ref":"dev","sha":"ce06229c42065d1c409e1f4ee9d7db66d106bb75","user":{"login":"home-assistant","id":13844975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzODQ0OTc1","avatar_url":"https://avatars3.githubusercontent.com/u/13844975?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg4ODk5Mw==","name":"home-assistant","full_name":"home-assistant/home-assistant","owner":{"login":"home-assistant","id":13844975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzODQ0OTc1","avatar_url":"https://avatars3.githubusercontent.com/u/13844975?v=4","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 that puts local control and privacy first","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":"2018-09-08T00:54:44Z","pushed_at":"2018-09-08T02:53:47Z","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":87964,"stargazers_count":16544,"watchers_count":16544,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4874,"mirror_url":null,"archived":false,"open_issues_count":837,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":4874,"open_issues":837,"watchers":16544,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/16472"},"issue":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/16472"},"comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/16472/comments"},"review_comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/16472/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/16472/commits"},"statuses":{"href":"https://api.github.com/repos/home-assistant/home-assistant/statuses/043860c0e86835baa3508cc6deae8edf160c2488"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MartinHjelmare"}}