{"action":"created","comment":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/72428029","id":72428029,"diff_hunk":"@@ -0,0 +1,106 @@\n+\"\"\"\n+Support to interface with the MPC-HC Web API.\n+\n+For more details about this platform, please refer to the documentation at\n+https://home-assistant.io/components/media_player.mpchc/\n+\"\"\"\n+import logging\n+import requests\n+import re\n+\n+from homeassistant.components.media_player import (\n+    MediaPlayerDevice)\n+from homeassistant.const import (\n+    STATE_OFF, STATE_IDLE, STATE_PAUSED, STATE_PLAYING)\n+\n+_LOGGER = logging.getLogger(__name__)\n+\n+# pylint: disable=unused-argument\n+def setup_platform(hass, config, add_devices, discovery_info=None):\n+    \"\"\"Setup the MPC-HC platform.\"\"\"\n+    name = config.get(\"name\", \"MPC-HC\")\n+    url = '{}:{}'.format(config.get('host'), config.get('port', '13579'))\n+\n+    if config.get('host') is None:\n+        _LOGGER.error(\"Missing NPC-HC host address in config\")\n+        return False\n+\n+    add_devices([MpcHcDevice(name, url)])\n+\n+\n+class MpcHcDevice(MediaPlayerDevice):","path":"homeassistant/components/media_player/mpchc.py","position":31,"original_position":31,"commit_id":"adee108291e956b43f63cbb8e2c48456d4f57d64","original_commit_id":"adee108291e956b43f63cbb8e2c48456d4f57d64","user":{"login":"balloobbot","id":16367972,"avatar_url":"https://avatars.githubusercontent.com/u/16367972?v=3","gravatar_id":"","url":"https://api.github.com/users/balloobbot","html_url":"https://github.com/balloobbot","followers_url":"https://api.github.com/users/balloobbot/followers","following_url":"https://api.github.com/users/balloobbot/following{/other_user}","gists_url":"https://api.github.com/users/balloobbot/gists{/gist_id}","starred_url":"https://api.github.com/users/balloobbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balloobbot/subscriptions","organizations_url":"https://api.github.com/users/balloobbot/orgs","repos_url":"https://api.github.com/users/balloobbot/repos","events_url":"https://api.github.com/users/balloobbot/events{/privacy}","received_events_url":"https://api.github.com/users/balloobbot/received_events","type":"User","site_admin":false},"body":"_[farcy v1.1](https://github.com/appfolio/farcy)_\n* D204: 1 blank line required after class docstring (found 0)","created_at":"2016-07-27T12:13:51Z","updated_at":"2016-07-27T12:13:51Z","html_url":"https://github.com/home-assistant/home-assistant/pull/2635#discussion_r72428029","pull_request_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635","_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/comments/72428029"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/2635#discussion_r72428029"},"pull_request":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635"}}},"pull_request":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635","id":79013130,"html_url":"https://github.com/home-assistant/home-assistant/pull/2635","diff_url":"https://github.com/home-assistant/home-assistant/pull/2635.diff","patch_url":"https://github.com/home-assistant/home-assistant/pull/2635.patch","issue_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2635","number":2635,"state":"open","locked":false,"title":"Add MPC-HC Media Player Component","user":{"login":"abcminiuser","id":141648,"avatar_url":"https://avatars.githubusercontent.com/u/141648?v=3","gravatar_id":"","url":"https://api.github.com/users/abcminiuser","html_url":"https://github.com/abcminiuser","followers_url":"https://api.github.com/users/abcminiuser/followers","following_url":"https://api.github.com/users/abcminiuser/following{/other_user}","gists_url":"https://api.github.com/users/abcminiuser/gists{/gist_id}","starred_url":"https://api.github.com/users/abcminiuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcminiuser/subscriptions","organizations_url":"https://api.github.com/users/abcminiuser/orgs","repos_url":"https://api.github.com/users/abcminiuser/repos","events_url":"https://api.github.com/users/abcminiuser/events{/privacy}","received_events_url":"https://api.github.com/users/abcminiuser/received_events","type":"User","site_admin":false},"body":"**Description:**\r\n\r\nThis adds a new media player platform, for Media Player Classic Home Cinema (MPC-HC). Currently this is a read-only `media_player` component intended for home automation, but I'm happy to extend it to support play/pause/etc. actions in the immediate future if there's any interest. I'm currently using this to dim my study lights when media is being played.\r\n\r\n**Example entry for `configuration.yaml` (if applicable):**\r\n```yaml\r\nmedia_player:\r\n  - platform: mpchc\r\n    port: 13579\r\n    host: http://127.0.0.1\r\n```","created_at":"2016-07-27T12:12:57Z","updated_at":"2016-07-27T12:13:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccc646fce5b4e74628ff47e7bb176724889360a2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635/commits","review_comments_url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635/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/2635/comments","statuses_url":"https://api.github.com/repos/home-assistant/home-assistant/statuses/adee108291e956b43f63cbb8e2c48456d4f57d64","head":{"label":"abcminiuser:add_mpchc_mediaplayer","ref":"add_mpchc_mediaplayer","sha":"adee108291e956b43f63cbb8e2c48456d4f57d64","user":{"login":"abcminiuser","id":141648,"avatar_url":"https://avatars.githubusercontent.com/u/141648?v=3","gravatar_id":"","url":"https://api.github.com/users/abcminiuser","html_url":"https://github.com/abcminiuser","followers_url":"https://api.github.com/users/abcminiuser/followers","following_url":"https://api.github.com/users/abcminiuser/following{/other_user}","gists_url":"https://api.github.com/users/abcminiuser/gists{/gist_id}","starred_url":"https://api.github.com/users/abcminiuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcminiuser/subscriptions","organizations_url":"https://api.github.com/users/abcminiuser/orgs","repos_url":"https://api.github.com/users/abcminiuser/repos","events_url":"https://api.github.com/users/abcminiuser/events{/privacy}","received_events_url":"https://api.github.com/users/abcminiuser/received_events","type":"User","site_admin":false},"repo":{"id":64303538,"name":"home-assistant","full_name":"abcminiuser/home-assistant","owner":{"login":"abcminiuser","id":141648,"avatar_url":"https://avatars.githubusercontent.com/u/141648?v=3","gravatar_id":"","url":"https://api.github.com/users/abcminiuser","html_url":"https://github.com/abcminiuser","followers_url":"https://api.github.com/users/abcminiuser/followers","following_url":"https://api.github.com/users/abcminiuser/following{/other_user}","gists_url":"https://api.github.com/users/abcminiuser/gists{/gist_id}","starred_url":"https://api.github.com/users/abcminiuser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcminiuser/subscriptions","organizations_url":"https://api.github.com/users/abcminiuser/orgs","repos_url":"https://api.github.com/users/abcminiuser/repos","events_url":"https://api.github.com/users/abcminiuser/events{/privacy}","received_events_url":"https://api.github.com/users/abcminiuser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abcminiuser/home-assistant","description":":house_with_garden: Open-source home automation platform running on Python 3","fork":true,"url":"https://api.github.com/repos/abcminiuser/home-assistant","forks_url":"https://api.github.com/repos/abcminiuser/home-assistant/forks","keys_url":"https://api.github.com/repos/abcminiuser/home-assistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abcminiuser/home-assistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abcminiuser/home-assistant/teams","hooks_url":"https://api.github.com/repos/abcminiuser/home-assistant/hooks","issue_events_url":"https://api.github.com/repos/abcminiuser/home-assistant/issues/events{/number}","events_url":"https://api.github.com/repos/abcminiuser/home-assistant/events","assignees_url":"https://api.github.com/repos/abcminiuser/home-assistant/assignees{/user}","branches_url":"https://api.github.com/repos/abcminiuser/home-assistant/branches{/branch}","tags_url":"https://api.github.com/repos/abcminiuser/home-assistant/tags","blobs_url":"https://api.github.com/repos/abcminiuser/home-assistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abcminiuser/home-assistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abcminiuser/home-assistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/abcminiuser/home-assistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abcminiuser/home-assistant/statuses/{sha}","languages_url":"https://api.github.com/repos/abcminiuser/home-assistant/languages","stargazers_url":"https://api.github.com/repos/abcminiuser/home-assistant/stargazers","contributors_url":"https://api.github.com/repos/abcminiuser/home-assistant/contributors","subscribers_url":"https://api.github.com/repos/abcminiuser/home-assistant/subscribers","subscription_url":"https://api.github.com/repos/abcminiuser/home-assistant/subscription","commits_url":"https://api.github.com/repos/abcminiuser/home-assistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/abcminiuser/home-assistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/abcminiuser/home-assistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/abcminiuser/home-assistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/abcminiuser/home-assistant/contents/{+path}","compare_url":"https://api.github.com/repos/abcminiuser/home-assistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abcminiuser/home-assistant/merges","archive_url":"https://api.github.com/repos/abcminiuser/home-assistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abcminiuser/home-assistant/downloads","issues_url":"https://api.github.com/repos/abcminiuser/home-assistant/issues{/number}","pulls_url":"https://api.github.com/repos/abcminiuser/home-assistant/pulls{/number}","milestones_url":"https://api.github.com/repos/abcminiuser/home-assistant/milestones{/number}","notifications_url":"https://api.github.com/repos/abcminiuser/home-assistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abcminiuser/home-assistant/labels{/name}","releases_url":"https://api.github.com/repos/abcminiuser/home-assistant/releases{/id}","deployments_url":"https://api.github.com/repos/abcminiuser/home-assistant/deployments","created_at":"2016-07-27T11:38:18Z","updated_at":"2016-07-27T11:38:21Z","pushed_at":"2016-07-27T12:09:32Z","git_url":"git://github.com/abcminiuser/home-assistant.git","ssh_url":"git@github.com:abcminiuser/home-assistant.git","clone_url":"https://github.com/abcminiuser/home-assistant.git","svn_url":"https://github.com/abcminiuser/home-assistant","homepage":"https://home-assistant.io","size":96150,"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":"dev"}},"base":{"label":"home-assistant:dev","ref":"dev","sha":"8c728d1b4eaf5f66570d7a9d139cd8e1940c551f","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-07-27T09:29:31Z","pushed_at":"2016-07-27T12:12:57Z","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":96211,"stargazers_count":3766,"watchers_count":3766,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":842,"mirror_url":null,"open_issues_count":169,"forks":842,"open_issues":169,"watchers":3766,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635"},"html":{"href":"https://github.com/home-assistant/home-assistant/pull/2635"},"issue":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/2635"},"comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/issues/2635/comments"},"review_comments":{"href":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2635/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/2635/commits"},"statuses":{"href":"https://api.github.com/repos/home-assistant/home-assistant/statuses/adee108291e956b43f63cbb8e2c48456d4f57d64"}}}}
{"actor":{"display_login":"balloobbot"}}