{"action":"created","comment":{"url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/comments/85646314","pull_request_review_id":6352344,"id":85646314,"diff_hunk":"@@ -32,28 +32,34 @@ class TelldusTDToolPlatform {\n     this.log = log\n     this.config = config\n     this.homebridge = homebridge\n+    this.senzors = config[\"sensors\"] || [];\n   }\n \n   accessories(callback) {\n     this.log('Loading devices...')\n     TDtool.listDevices().then(deviceCandidates => {\n       const devices = deviceCandidates.filter(d => d.type === 'device')\n-      this.log(foundOfTypeString('device', devices.length))\n+      this.log(foundOfTypeString('device', devices.length, 'tdtool --list-devices'))\n       return devices\n     }).then(devices => {\n-      return TDtool.listSensors().then(sensors => {\n-        this.log(foundOfTypeString('sensor', sensors.length))\n-        sensors.forEach((current, index) => {sensors[index].name = `Thermometer ${current.id}`})\n-        return devices.concat(sensors)\n-      })\n+      if (this.senzors.length > 0) {\n+        this.log(foundOfTypeString('sensor', this.senzors.length, 'config.json'))","path":"src/index.js","position":32,"original_position":32,"commit_id":"ff379b49be3d018efa7942380e8235f205c69a37","original_commit_id":"ff379b49be3d018efa7942380e8235f205c69a37","user":{"login":"amlinger","id":2642590,"avatar_url":"https://avatars.githubusercontent.com/u/2642590?v=3","gravatar_id":"","url":"https://api.github.com/users/amlinger","html_url":"https://github.com/amlinger","followers_url":"https://api.github.com/users/amlinger/followers","following_url":"https://api.github.com/users/amlinger/following{/other_user}","gists_url":"https://api.github.com/users/amlinger/gists{/gist_id}","starred_url":"https://api.github.com/users/amlinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlinger/subscriptions","organizations_url":"https://api.github.com/users/amlinger/orgs","repos_url":"https://api.github.com/users/amlinger/repos","events_url":"https://api.github.com/users/amlinger/events{/privacy}","received_events_url":"https://api.github.com/users/amlinger/received_events","type":"User","site_admin":false},"body":"As this is user input, we should verify that the fields supplied are `'name'` (optional), `'type'` and `'id'` and nothing else.","created_at":"2016-10-29T19:12:23Z","updated_at":"2016-10-29T19:21:48Z","html_url":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31#discussion_r85646314","pull_request_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/comments/85646314"},"html":{"href":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31#discussion_r85646314"},"pull_request":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31","id":90297694,"html_url":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31","diff_url":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31.diff","patch_url":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31.patch","issue_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/31","number":31,"state":"open","locked":false,"title":"Use config.json for configuring sensors.","user":{"login":"jannylund","id":121457,"avatar_url":"https://avatars.githubusercontent.com/u/121457?v=3","gravatar_id":"","url":"https://api.github.com/users/jannylund","html_url":"https://github.com/jannylund","followers_url":"https://api.github.com/users/jannylund/followers","following_url":"https://api.github.com/users/jannylund/following{/other_user}","gists_url":"https://api.github.com/users/jannylund/gists{/gist_id}","starred_url":"https://api.github.com/users/jannylund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jannylund/subscriptions","organizations_url":"https://api.github.com/users/jannylund/orgs","repos_url":"https://api.github.com/users/jannylund/repos","events_url":"https://api.github.com/users/jannylund/events{/privacy}","received_events_url":"https://api.github.com/users/jannylund/received_events","type":"User","site_admin":false},"body":"This PR adds the functionality to use config file as documented in https://github.com/amlinger/homebridge-telldus-tdtool/issues/30\r\n\r\n```\r\n\"platforms\": [\r\n        {\r\n            \"name\": \"TellstickDuo\",\r\n            \"platform\": \"Telldus-TD-Tool\",\r\n            \"sensors\": [\r\n                {\r\n                    \"id\": 114,\r\n                    \"model\": \"temperaturehumidity\",\r\n                    \"name\": \"Bathroom\"\r\n                },\r\n                {\r\n                    \"id\": 142,\r\n                    \"model\": \"temperature\",\r\n                    \"name\": \"Sauna\"\r\n                },\r\n                {\r\n                    \"id\": 74,\r\n                    \"model\": \"temperature\",\r\n                    \"name\": \"Freezer\"\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n```\r\n\r\n- Leaving out the `sensors` array or adding an empty array, it will work as before (Except the removed feature override sensortype, since that is done in config file)\r\n- Adding a `sensors` array brings the following features:\r\n - No false sensors will show up.\r\n - Setting the name in `config.json` ensures it's always the same (correct) name.\r\n - Setting the proper model in `config.json` allows reconfiguration of false `temperaturehumidity` as `temperature`.\r\n\r\nEach sensor need to have two mandatory members, `id` (to identify it uniquely) and `model` (since we don't know that at this stage).","created_at":"2016-10-20T23:10:01Z","updated_at":"2016-10-29T19:21:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53af00a11861e2afc254b4e88523332bb709eca0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31/commits","review_comments_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31/comments","review_comment_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/31/comments","statuses_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/statuses/ff379b49be3d018efa7942380e8235f205c69a37","head":{"label":"jannylund:use-config-file-for-sensors","ref":"use-config-file-for-sensors","sha":"ff379b49be3d018efa7942380e8235f205c69a37","user":{"login":"jannylund","id":121457,"avatar_url":"https://avatars.githubusercontent.com/u/121457?v=3","gravatar_id":"","url":"https://api.github.com/users/jannylund","html_url":"https://github.com/jannylund","followers_url":"https://api.github.com/users/jannylund/followers","following_url":"https://api.github.com/users/jannylund/following{/other_user}","gists_url":"https://api.github.com/users/jannylund/gists{/gist_id}","starred_url":"https://api.github.com/users/jannylund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jannylund/subscriptions","organizations_url":"https://api.github.com/users/jannylund/orgs","repos_url":"https://api.github.com/users/jannylund/repos","events_url":"https://api.github.com/users/jannylund/events{/privacy}","received_events_url":"https://api.github.com/users/jannylund/received_events","type":"User","site_admin":false},"repo":{"id":70397158,"name":"homebridge-telldus-tdtool","full_name":"jannylund/homebridge-telldus-tdtool","owner":{"login":"jannylund","id":121457,"avatar_url":"https://avatars.githubusercontent.com/u/121457?v=3","gravatar_id":"","url":"https://api.github.com/users/jannylund","html_url":"https://github.com/jannylund","followers_url":"https://api.github.com/users/jannylund/followers","following_url":"https://api.github.com/users/jannylund/following{/other_user}","gists_url":"https://api.github.com/users/jannylund/gists{/gist_id}","starred_url":"https://api.github.com/users/jannylund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jannylund/subscriptions","organizations_url":"https://api.github.com/users/jannylund/orgs","repos_url":"https://api.github.com/users/jannylund/repos","events_url":"https://api.github.com/users/jannylund/events{/privacy}","received_events_url":"https://api.github.com/users/jannylund/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jannylund/homebridge-telldus-tdtool","description":"A Homebridge plugin for Tellstick without Live, interfaced with the CLI tool tdtool.","fork":true,"url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool","forks_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/forks","keys_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/teams","hooks_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/hooks","issue_events_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/issues/events{/number}","events_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/events","assignees_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/assignees{/user}","branches_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/branches{/branch}","tags_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/tags","blobs_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/git/refs{/sha}","trees_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/statuses/{sha}","languages_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/languages","stargazers_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/stargazers","contributors_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/contributors","subscribers_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/subscribers","subscription_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/subscription","commits_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/commits{/sha}","git_commits_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/git/commits{/sha}","comments_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/comments{/number}","issue_comment_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/issues/comments{/number}","contents_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/contents/{+path}","compare_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/merges","archive_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/downloads","issues_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/issues{/number}","pulls_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/pulls{/number}","milestones_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/milestones{/number}","notifications_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/labels{/name}","releases_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/releases{/id}","deployments_url":"https://api.github.com/repos/jannylund/homebridge-telldus-tdtool/deployments","created_at":"2016-10-09T10:56:12Z","updated_at":"2016-10-09T10:56:13Z","pushed_at":"2016-10-27T22:40:55Z","git_url":"git://github.com/jannylund/homebridge-telldus-tdtool.git","ssh_url":"git@github.com:jannylund/homebridge-telldus-tdtool.git","clone_url":"https://github.com/jannylund/homebridge-telldus-tdtool.git","svn_url":"https://github.com/jannylund/homebridge-telldus-tdtool","homepage":null,"size":33,"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":"amlinger:master","ref":"master","sha":"cc3786b47b04ffdb9e820ea702b424abf9a1fd4e","user":{"login":"amlinger","id":2642590,"avatar_url":"https://avatars.githubusercontent.com/u/2642590?v=3","gravatar_id":"","url":"https://api.github.com/users/amlinger","html_url":"https://github.com/amlinger","followers_url":"https://api.github.com/users/amlinger/followers","following_url":"https://api.github.com/users/amlinger/following{/other_user}","gists_url":"https://api.github.com/users/amlinger/gists{/gist_id}","starred_url":"https://api.github.com/users/amlinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlinger/subscriptions","organizations_url":"https://api.github.com/users/amlinger/orgs","repos_url":"https://api.github.com/users/amlinger/repos","events_url":"https://api.github.com/users/amlinger/events{/privacy}","received_events_url":"https://api.github.com/users/amlinger/received_events","type":"User","site_admin":false},"repo":{"id":55350268,"name":"homebridge-telldus-tdtool","full_name":"amlinger/homebridge-telldus-tdtool","owner":{"login":"amlinger","id":2642590,"avatar_url":"https://avatars.githubusercontent.com/u/2642590?v=3","gravatar_id":"","url":"https://api.github.com/users/amlinger","html_url":"https://github.com/amlinger","followers_url":"https://api.github.com/users/amlinger/followers","following_url":"https://api.github.com/users/amlinger/following{/other_user}","gists_url":"https://api.github.com/users/amlinger/gists{/gist_id}","starred_url":"https://api.github.com/users/amlinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlinger/subscriptions","organizations_url":"https://api.github.com/users/amlinger/orgs","repos_url":"https://api.github.com/users/amlinger/repos","events_url":"https://api.github.com/users/amlinger/events{/privacy}","received_events_url":"https://api.github.com/users/amlinger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amlinger/homebridge-telldus-tdtool","description":"A Homebridge plugin for Tellstick without Live, interfaced with the CLI tool tdtool.","fork":false,"url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool","forks_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/forks","keys_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/teams","hooks_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/hooks","issue_events_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/events{/number}","events_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/events","assignees_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/assignees{/user}","branches_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/branches{/branch}","tags_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/tags","blobs_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/git/refs{/sha}","trees_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/statuses/{sha}","languages_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/languages","stargazers_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/stargazers","contributors_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/contributors","subscribers_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/subscribers","subscription_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/subscription","commits_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/commits{/sha}","git_commits_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/git/commits{/sha}","comments_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/comments{/number}","issue_comment_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/comments{/number}","contents_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/contents/{+path}","compare_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/merges","archive_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/downloads","issues_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues{/number}","pulls_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls{/number}","milestones_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/milestones{/number}","notifications_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/labels{/name}","releases_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/releases{/id}","deployments_url":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/deployments","created_at":"2016-04-03T14:27:18Z","updated_at":"2016-10-27T22:33:27Z","pushed_at":"2016-10-27T22:40:56Z","git_url":"git://github.com/amlinger/homebridge-telldus-tdtool.git","ssh_url":"git@github.com:amlinger/homebridge-telldus-tdtool.git","clone_url":"https://github.com/amlinger/homebridge-telldus-tdtool.git","svn_url":"https://github.com/amlinger/homebridge-telldus-tdtool","homepage":null,"size":45,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31"},"html":{"href":"https://github.com/amlinger/homebridge-telldus-tdtool/pull/31"},"issue":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/31"},"comments":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/amlinger/homebridge-telldus-tdtool/statuses/ff379b49be3d018efa7942380e8235f205c69a37"}}}}
{"actor":{"display_login":"amlinger"}}