{"action":"created","comment":{"url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/comments/94259052","pull_request_review_id":14790558,"id":94259052,"diff_hunk":"@@ -150,23 +251,84 @@ HomeAssistantLight.prototype = {\n     var informationService = new Service.AccessoryInformation();\n \n     informationService\n-      .setCharacteristic(Characteristic.Manufacturer, \"Home Assistant\")\n-      .setCharacteristic(Characteristic.Model, \"Light\")\n-      .setCharacteristic(Characteristic.SerialNumber, this.entity_id);\n+        .setCharacteristic(Characteristic.Manufacturer, \"Home Assistant\")\n+        .setCharacteristic(Characteristic.Model, \"Light\")\n+        .setCharacteristic(Characteristic.SerialNumber, this.entity_id);\n \n     this.lightbulbService\n-      .getCharacteristic(Characteristic.On)\n-      .on('get', this.getPowerState.bind(this))\n-      .on('set', this.setPowerState.bind(this));\n+        .getCharacteristic(Characteristic.On)\n+        .on('get', this.getPowerState.bind(this))\n+        .on('set', this.setPowerState.bind(this));\n \n     if (this.is_supported(this.features.BRIGHTNESS)) {\n       this.lightbulbService\n-        .addCharacteristic(Characteristic.Brightness)\n-        .on('get', this.getBrightness.bind(this))\n-        .on('set', this.setBrightness.bind(this));\n+          .addCharacteristic(Characteristic.Brightness)\n+          .on('get', this.getBrightness.bind(this))\n+          .on('set', this.setBrightness.bind(this));\n+    }\n+\n+    if (this.is_supported(this.features.RGB_COLOR)) {\n+      this.lightbulbService\n+          .addCharacteristic(Characteristic.Hue)\n+          .on('get', this.getHue.bind(this))\n+          .on('set', this.setHue.bind(this));\n+\n+      this.lightbulbService\n+          .addCharacteristic(Characteristic.Saturation)\n+          .on('get', this.getSaturation.bind(this))\n+          .on('set', this.setSaturation.bind(this));\n     }\n \n     return [informationService, this.lightbulbService];\n   }\n+};\n \n-}\n+var LightUtil = {\n+  hsvToRgb: function(h, s, v) {\n+    var r, g, b, i, f, p, q, t;\n+    if (arguments.length === 1) {\n+      s = h.s, v = h.v, h = h.h;","path":"accessories/light.js","position":303,"original_position":303,"commit_id":"ef300cbeafde72c29f41a028ab5bfb7b111dc1f7","original_commit_id":"ef300cbeafde72c29f41a028ab5bfb7b111dc1f7","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Expected an assignment or function call and instead saw an expression.","created_at":"2016-12-30T21:27:28Z","updated_at":"2016-12-30T21:27:28Z","html_url":"https://github.com/home-assistant/homebridge-homeassistant/pull/85#discussion_r94259052","pull_request_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/comments/94259052"},"html":{"href":"https://github.com/home-assistant/homebridge-homeassistant/pull/85#discussion_r94259052"},"pull_request":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85","id":99784430,"html_url":"https://github.com/home-assistant/homebridge-homeassistant/pull/85","diff_url":"https://github.com/home-assistant/homebridge-homeassistant/pull/85.diff","patch_url":"https://github.com/home-assistant/homebridge-homeassistant/pull/85.patch","issue_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/85","number":85,"state":"open","locked":false,"title":"RGB lights support","user":{"login":"tobre6","id":1629750,"avatar_url":"https://avatars.githubusercontent.com/u/1629750?v=3","gravatar_id":"","url":"https://api.github.com/users/tobre6","html_url":"https://github.com/tobre6","followers_url":"https://api.github.com/users/tobre6/followers","following_url":"https://api.github.com/users/tobre6/following{/other_user}","gists_url":"https://api.github.com/users/tobre6/gists{/gist_id}","starred_url":"https://api.github.com/users/tobre6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobre6/subscriptions","organizations_url":"https://api.github.com/users/tobre6/orgs","repos_url":"https://api.github.com/users/tobre6/repos","events_url":"https://api.github.com/users/tobre6/events{/privacy}","received_events_url":"https://api.github.com/users/tobre6/received_events","type":"User","site_admin":false},"body":"There have been some PRs and issues about RGB support for lights, but even there is an interest nobody haven't resolved the problem yet. So I'm giving to try.\r\n\r\nThis is the initial working version of the RGB lights.\r\n\r\nDifferent RGB PRs and issues have been quite useful and descriptive of the problem. For example PR https://github.com/home-assistant/homebridge-homeassistant/pull/11\r\n\r\nThe main problem of the topic isn't just different standards. HA uses RGB as well as the led stripes, but HomeKit uses HSV (HSB), where V (B) is value or brightness. So you have to convert from one to another, but extra dimension is added from HA as well. In HA UI there is RGB color picker and brightness at the same time. Converting from RGB to HSV you can calculate brightness or giving brightness, it is possible to calculate respective RGB value.\r\n\r\nUseful calculators:\r\nhttp://www.rapidtables.com/convert/color/hsv-to-rgb.htm\r\nhttp://www.rapidtables.com/convert/color/rgb-to-hsv.htm\r\n\r\nSo my approach from HA perspective is when I choose darker colors, brightness is adjusted to lower and when brighter colors, brightness will be higher.\r\n\r\nWhen changing hue and saturation from HomeKit, I'm calculating respective RGB value and sending this to HA and when changing brightness value I'm also calculating the RGB value and sending this to HA.\r\n\r\nFrom hardware side I'm using RGB led stripe and MQTT lights.\r\n\r\nThis logic works good and intuitive from HA and HomeKit. So I think you should give it a try at least.\r\n\r\nI'm using docker to run homebridge on Raspberry.\r\nYou can test to run my PR when using development tag: https://hub.docker.com/r/tobre/rpi-homebridge-homeassistant/\r\nIt uses code from: https://github.com/tobre6/homebridge-homeassistant\r\n\r\nOpen question for now is how should RGBW converted? Or even RGBWW where there are warm and cold whites used separately? But I think this is matter of another PR. :)\r\n\r\nLet me know if you have questions or ideas.","created_at":"2016-12-30T21:27:20Z","updated_at":"2016-12-30T21:27:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfe01abbefa6abc1a45e3f5c7725082d6db0a138","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85/commits","review_comments_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85/comments","review_comment_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/85/comments","statuses_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/statuses/ef300cbeafde72c29f41a028ab5bfb7b111dc1f7","head":{"label":"tobre6:master","ref":"master","sha":"ef300cbeafde72c29f41a028ab5bfb7b111dc1f7","user":{"login":"tobre6","id":1629750,"avatar_url":"https://avatars.githubusercontent.com/u/1629750?v=3","gravatar_id":"","url":"https://api.github.com/users/tobre6","html_url":"https://github.com/tobre6","followers_url":"https://api.github.com/users/tobre6/followers","following_url":"https://api.github.com/users/tobre6/following{/other_user}","gists_url":"https://api.github.com/users/tobre6/gists{/gist_id}","starred_url":"https://api.github.com/users/tobre6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobre6/subscriptions","organizations_url":"https://api.github.com/users/tobre6/orgs","repos_url":"https://api.github.com/users/tobre6/repos","events_url":"https://api.github.com/users/tobre6/events{/privacy}","received_events_url":"https://api.github.com/users/tobre6/received_events","type":"User","site_admin":false},"repo":{"id":77622771,"name":"homebridge-homeassistant","full_name":"tobre6/homebridge-homeassistant","owner":{"login":"tobre6","id":1629750,"avatar_url":"https://avatars.githubusercontent.com/u/1629750?v=3","gravatar_id":"","url":"https://api.github.com/users/tobre6","html_url":"https://github.com/tobre6","followers_url":"https://api.github.com/users/tobre6/followers","following_url":"https://api.github.com/users/tobre6/following{/other_user}","gists_url":"https://api.github.com/users/tobre6/gists{/gist_id}","starred_url":"https://api.github.com/users/tobre6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobre6/subscriptions","organizations_url":"https://api.github.com/users/tobre6/orgs","repos_url":"https://api.github.com/users/tobre6/repos","events_url":"https://api.github.com/users/tobre6/events{/privacy}","received_events_url":"https://api.github.com/users/tobre6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tobre6/homebridge-homeassistant","description":" Homebridge plugin for Home Assistant","fork":true,"url":"https://api.github.com/repos/tobre6/homebridge-homeassistant","forks_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/forks","keys_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/teams","hooks_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/hooks","issue_events_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/issues/events{/number}","events_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/events","assignees_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/assignees{/user}","branches_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/branches{/branch}","tags_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/tags","blobs_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/statuses/{sha}","languages_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/languages","stargazers_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/stargazers","contributors_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/contributors","subscribers_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/subscribers","subscription_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/subscription","commits_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/contents/{+path}","compare_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/merges","archive_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/downloads","issues_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/issues{/number}","pulls_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/pulls{/number}","milestones_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/milestones{/number}","notifications_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/labels{/name}","releases_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/releases{/id}","deployments_url":"https://api.github.com/repos/tobre6/homebridge-homeassistant/deployments","created_at":"2016-12-29T15:49:31Z","updated_at":"2016-12-29T15:49:35Z","pushed_at":"2016-12-30T20:27:14Z","git_url":"git://github.com/tobre6/homebridge-homeassistant.git","ssh_url":"git@github.com:tobre6/homebridge-homeassistant.git","clone_url":"https://github.com/tobre6/homebridge-homeassistant.git","svn_url":"https://github.com/tobre6/homebridge-homeassistant","homepage":"","size":70,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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:master","ref":"master","sha":"a2e20f90e9395017f48d95a0ee2f3a2aa703a17b","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":53466975,"name":"homebridge-homeassistant","full_name":"home-assistant/homebridge-homeassistant","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/homebridge-homeassistant","description":" Homebridge plugin for Home Assistant","fork":false,"url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant","forks_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/forks","keys_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/teams","hooks_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/hooks","issue_events_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/events{/number}","events_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/events","assignees_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/assignees{/user}","branches_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/branches{/branch}","tags_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/tags","blobs_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/git/refs{/sha}","trees_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/statuses/{sha}","languages_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/languages","stargazers_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/stargazers","contributors_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/contributors","subscribers_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/subscribers","subscription_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/subscription","commits_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/commits{/sha}","git_commits_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/git/commits{/sha}","comments_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/comments{/number}","issue_comment_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/comments{/number}","contents_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/contents/{+path}","compare_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/merges","archive_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/downloads","issues_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues{/number}","pulls_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls{/number}","milestones_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/milestones{/number}","notifications_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/labels{/name}","releases_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/releases{/id}","deployments_url":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/deployments","created_at":"2016-03-09T04:02:55Z","updated_at":"2016-12-29T09:23:18Z","pushed_at":"2016-12-30T21:27:21Z","git_url":"git://github.com/home-assistant/homebridge-homeassistant.git","ssh_url":"git@github.com:home-assistant/homebridge-homeassistant.git","clone_url":"https://github.com/home-assistant/homebridge-homeassistant.git","svn_url":"https://github.com/home-assistant/homebridge-homeassistant","homepage":"","size":63,"stargazers_count":120,"watchers_count":120,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":19,"forks":29,"open_issues":19,"watchers":120,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85"},"html":{"href":"https://github.com/home-assistant/homebridge-homeassistant/pull/85"},"issue":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/85"},"comments":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/home-assistant/homebridge-homeassistant/statuses/ef300cbeafde72c29f41a028ab5bfb7b111dc1f7"}}}}
{"actor":{"display_login":"houndci-bot"}}