{"action":"created","comment":{"url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/comments/149679917","pull_request_review_id":75100257,"id":149679917,"diff_hunk":"@@ -0,0 +1,57 @@\n+/**\n+ * Copyright (c) 2010-2017 by the respective copyright holders.\n+ *\n+ * All rights reserved. This program and the accompanying materials\n+ * are made available under the terms of the Eclipse Public License v1.0\n+ * which accompanies this distribution, and is available at\n+ * http://www.eclipse.org/legal/epl-v10.html\n+ */\n+\n+package org.openhab.binding.smappee.service;\n+\n+/**\n+ * The result of a smappee reading\n+ *\n+ * @author Niko Tanghe\n+ */\n+\n+public class SmappeeDeviceReading {\n+    public int serviceLocationId;\n+    public SmappeeDeviceReadingConsumption[] consumptions;\n+\n+    public double getLatestConsumption() {\n+        if (consumptions.length == 0) {\n+            return 0;\n+        }\n+        return getLatestReading().consumption;\n+    }\n+\n+    public double getLatestSolar() {\n+        if (consumptions.length == 0) {\n+            return 0;\n+        }\n+        return getLatestReading().solar;\n+    }\n+\n+    public double getLatestAlwaysOn() {\n+        if (consumptions.length == 0) {\n+            return 0;\n+        }\n+        return getLatestReading().alwaysOn;\n+    }\n+\n+    private SmappeeDeviceReadingConsumption getLatestReading() {\n+        if (consumptions.length == 0) {","path":"addons/binding/org.openhab.binding.smappee/src/main/java/org/openhab/binding/smappee/service/SmappeeDeviceReading.java","position":44,"original_position":44,"commit_id":"44c6846fe44ccf296ad722f052303ae091daa19e","original_commit_id":"44c6846fe44ccf296ad722f052303ae091daa19e","user":{"login":"Hilbrand","id":1272873,"avatar_url":"https://avatars1.githubusercontent.com/u/1272873?v=4","gravatar_id":"","url":"https://api.github.com/users/Hilbrand","html_url":"https://github.com/Hilbrand","followers_url":"https://api.github.com/users/Hilbrand/followers","following_url":"https://api.github.com/users/Hilbrand/following{/other_user}","gists_url":"https://api.github.com/users/Hilbrand/gists{/gist_id}","starred_url":"https://api.github.com/users/Hilbrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hilbrand/subscriptions","organizations_url":"https://api.github.com/users/Hilbrand/orgs","repos_url":"https://api.github.com/users/Hilbrand/repos","events_url":"https://api.github.com/users/Hilbrand/events{/privacy}","received_events_url":"https://api.github.com/users/Hilbrand/received_events","type":"User","site_admin":false},"body":"This check doesn't add anything because all callers already check for it. And they should because without that check a null would be returned causing a nullpointer as it's not checked for being null in the callers of this method.","created_at":"2017-11-08T14:17:22Z","updated_at":"2017-11-08T15:02:38Z","html_url":"https://github.com/openhab/openhab2-addons/pull/2815#discussion_r149679917","pull_request_url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/comments/149679917"},"html":{"href":"https://github.com/openhab/openhab2-addons/pull/2815#discussion_r149679917"},"pull_request":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815"}}},"pull_request":{"url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815","id":149626832,"html_url":"https://github.com/openhab/openhab2-addons/pull/2815","diff_url":"https://github.com/openhab/openhab2-addons/pull/2815.diff","patch_url":"https://github.com/openhab/openhab2-addons/pull/2815.patch","issue_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/2815","number":2815,"state":"open","locked":false,"title":"[Smappee] Added new 2.0 binding for the Smappee energy monitor","user":{"login":"nikotanghe","id":6616183,"avatar_url":"https://avatars2.githubusercontent.com/u/6616183?v=4","gravatar_id":"","url":"https://api.github.com/users/nikotanghe","html_url":"https://github.com/nikotanghe","followers_url":"https://api.github.com/users/nikotanghe/followers","following_url":"https://api.github.com/users/nikotanghe/following{/other_user}","gists_url":"https://api.github.com/users/nikotanghe/gists{/gist_id}","starred_url":"https://api.github.com/users/nikotanghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikotanghe/subscriptions","organizations_url":"https://api.github.com/users/nikotanghe/orgs","repos_url":"https://api.github.com/users/nikotanghe/repos","events_url":"https://api.github.com/users/nikotanghe/events{/privacy}","received_events_url":"https://api.github.com/users/nikotanghe/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Niko Tanghe ntanghe@gmail.com\r\n\r\n## Introduction\r\n\r\nThanks to the Smappee energy monitor you always know how much power your appliances consume, wherever you are. For more comfort, a better insight and sustainable energy savings up to 30%.\r\n\r\nBoth the Energy monitor and the Solar energy monitor can be used. These can be bought online in the [smappee webshop] (http://www.smappee.com/be_en/eshop/monitors.html).\r\n\r\nThe smappee supports clamps for 3 phase and 1 phase systems and there is a separate circuit clamp for your solar system. installation manuals can be found on [their support page](https://www.smappee.com/be_en/support)\r\n\r\n## Supported Things\r\n\r\nThis binding provides 1 thing type : 'smappee'. There should be only 1 smappee device installed in your home.\r\n\r\n## Discovery\r\n\r\nDiscovery is not supported for this binding, the smappee thing must be configured manually. \r\n\r\n## Thing Configuration\r\n\r\nAs described on their [support page] (https://support.smappee.com/hc/en-us/articles/202153935-Where-can-I-find-the-API-documentation-), you need to email [support@smappee.com] (mailto:support@smappee.com) to get a client ID and a client secret to access the api. In that mail you need to provide them :\r\n- Full name: your full name\r\n- Monitor serial number: this can be found at the back of your smappee\r\n- Account username: the username you use to log in in Smappee, same as thing setting 'Username'\r\n\r\n### Configuration in PaperUi\r\n\r\nFollowing settings must be configured in order to make your seneye binding work :\r\n\r\nClient Id : The Smappee Api Oauth client id (obtain by mail from smappee support)\r\nClient Secret : The Smappee Api Oauth client secret (obtain by mail from smappee support)\r\nUsername : The username of your Smappee\r\nPassword : The password of your Smappee\r\nService location name : The name of your Smappee installation\r\n\r\n### Configuration with config files\r\n\r\nA manual setup through a `things/smappee.things` file could look like this:\r\n\r\n```\r\nThing smappee:smappee:mySmappee \"Smappee\" @ \"Living Room\" [client_id=\"xxx\", client_secret=\"xxx\", username=\"xxx\", password=\"xxx\", servicelocationname=\"xxx\"]\r\n```\r\n\r\n## Channels\r\n\r\nThe following channels are supported :\r\n\r\n Channel Type ID         | Item Type    | Description  \r\n-------------------------|--------------|--------------\r\n consumption             | Number      | The amount of energy that is being consumed now\r\n solar                   | Number      | The amount of energy that is being generated by your solar power panels now\r\n alwayson                | Number      | The amount of energy that is always consumed\r\n \r\n## Item configuration\r\n\r\n### Configuration with config files\r\n\r\nA manual configuration through a `demo.items` file could look like this:\r\n\r\n```\r\nNumber mySmappee_Consumption  \"Consumption [%s]\"   { channel=\"smappee:smappee:mySmappee:consumption\" }\r\nNumber mySmappee_Solar        \"Solar [%s]\"         { channel=\"smappee:smappee:mySmappee:solar\" }\r\nNumber mySmappee_AlwaysOn     \"Always On [%s]\"     { channel=\"smappee:smappee:mySmappee:alwayson\" }\r\n```\r\n\r\n### Known Issues, to be implemented\r\n\r\n- The detected appliances don't appear as seperate devices in openhab.\r\n\r\n- The plugs can not be controlled with this binding.\r\n\r\n## Testing\r\n\r\n- Buy a smappee and install it into you domestic electricity system.\r\n- get the jar file from https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/\r\n- put the jar in your addons folder (for the location of the folder : http://docs.openhab.org/installation/linux.html#file-locations)\r\n- Contact support  for your API access, at this moment there is no setup screen in my smappee for this step :-(\r\n- Configure the binding\r\n\r\n\r\nQuestions ? Remarks ?\r\nLeave a message on the forum topic https://community.openhab.org/t/smappee-binding/35670\r\n","created_at":"2017-10-30T20:18:41Z","updated_at":"2017-11-08T15:02:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b8098a50c363a39cd551ac0d3294af16da2fe4a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815/commits","review_comments_url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815/comments","review_comment_url":"https://api.github.com/repos/openhab/openhab2-addons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/2815/comments","statuses_url":"https://api.github.com/repos/openhab/openhab2-addons/statuses/44c6846fe44ccf296ad722f052303ae091daa19e","head":{"label":"nikotanghe:Smappee","ref":"Smappee","sha":"44c6846fe44ccf296ad722f052303ae091daa19e","user":{"login":"nikotanghe","id":6616183,"avatar_url":"https://avatars2.githubusercontent.com/u/6616183?v=4","gravatar_id":"","url":"https://api.github.com/users/nikotanghe","html_url":"https://github.com/nikotanghe","followers_url":"https://api.github.com/users/nikotanghe/followers","following_url":"https://api.github.com/users/nikotanghe/following{/other_user}","gists_url":"https://api.github.com/users/nikotanghe/gists{/gist_id}","starred_url":"https://api.github.com/users/nikotanghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikotanghe/subscriptions","organizations_url":"https://api.github.com/users/nikotanghe/orgs","repos_url":"https://api.github.com/users/nikotanghe/repos","events_url":"https://api.github.com/users/nikotanghe/events{/privacy}","received_events_url":"https://api.github.com/users/nikotanghe/received_events","type":"User","site_admin":false},"repo":{"id":108816112,"name":"openhab2-addons","full_name":"nikotanghe/openhab2-addons","owner":{"login":"nikotanghe","id":6616183,"avatar_url":"https://avatars2.githubusercontent.com/u/6616183?v=4","gravatar_id":"","url":"https://api.github.com/users/nikotanghe","html_url":"https://github.com/nikotanghe","followers_url":"https://api.github.com/users/nikotanghe/followers","following_url":"https://api.github.com/users/nikotanghe/following{/other_user}","gists_url":"https://api.github.com/users/nikotanghe/gists{/gist_id}","starred_url":"https://api.github.com/users/nikotanghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikotanghe/subscriptions","organizations_url":"https://api.github.com/users/nikotanghe/orgs","repos_url":"https://api.github.com/users/nikotanghe/repos","events_url":"https://api.github.com/users/nikotanghe/events{/privacy}","received_events_url":"https://api.github.com/users/nikotanghe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nikotanghe/openhab2-addons","description":"Seneye/Smappee Add-on for openHAB 2.x","fork":true,"url":"https://api.github.com/repos/nikotanghe/openhab2-addons","forks_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/forks","keys_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/teams","hooks_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/hooks","issue_events_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/issues/events{/number}","events_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/events","assignees_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/assignees{/user}","branches_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/branches{/branch}","tags_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/tags","blobs_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/git/refs{/sha}","trees_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/statuses/{sha}","languages_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/languages","stargazers_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/stargazers","contributors_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/contributors","subscribers_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/subscribers","subscription_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/subscription","commits_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/commits{/sha}","git_commits_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/git/commits{/sha}","comments_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/comments{/number}","issue_comment_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/issues/comments{/number}","contents_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/contents/{+path}","compare_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/merges","archive_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/downloads","issues_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/issues{/number}","pulls_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/pulls{/number}","milestones_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/milestones{/number}","notifications_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/labels{/name}","releases_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/releases{/id}","deployments_url":"https://api.github.com/repos/nikotanghe/openhab2-addons/deployments","created_at":"2017-10-30T07:27:13Z","updated_at":"2017-10-30T19:28:35Z","pushed_at":"2017-11-07T20:29:05Z","git_url":"git://github.com/nikotanghe/openhab2-addons.git","ssh_url":"git@github.com:nikotanghe/openhab2-addons.git","clone_url":"https://github.com/nikotanghe/openhab2-addons.git","svn_url":"https://github.com/nikotanghe/openhab2-addons","homepage":"","size":263215,"stargazers_count":0,"watchers_count":0,"language":"Java","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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openhab:master","ref":"master","sha":"eb473ea39a0e0d2eb56033462c26caf9dcf6c0a4","user":{"login":"openhab","id":1007353,"avatar_url":"https://avatars0.githubusercontent.com/u/1007353?v=4","gravatar_id":"","url":"https://api.github.com/users/openhab","html_url":"https://github.com/openhab","followers_url":"https://api.github.com/users/openhab/followers","following_url":"https://api.github.com/users/openhab/following{/other_user}","gists_url":"https://api.github.com/users/openhab/gists{/gist_id}","starred_url":"https://api.github.com/users/openhab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhab/subscriptions","organizations_url":"https://api.github.com/users/openhab/orgs","repos_url":"https://api.github.com/users/openhab/repos","events_url":"https://api.github.com/users/openhab/events{/privacy}","received_events_url":"https://api.github.com/users/openhab/received_events","type":"Organization","site_admin":false},"repo":{"id":19753195,"name":"openhab2-addons","full_name":"openhab/openhab2-addons","owner":{"login":"openhab","id":1007353,"avatar_url":"https://avatars0.githubusercontent.com/u/1007353?v=4","gravatar_id":"","url":"https://api.github.com/users/openhab","html_url":"https://github.com/openhab","followers_url":"https://api.github.com/users/openhab/followers","following_url":"https://api.github.com/users/openhab/following{/other_user}","gists_url":"https://api.github.com/users/openhab/gists{/gist_id}","starred_url":"https://api.github.com/users/openhab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhab/subscriptions","organizations_url":"https://api.github.com/users/openhab/orgs","repos_url":"https://api.github.com/users/openhab/repos","events_url":"https://api.github.com/users/openhab/events{/privacy}","received_events_url":"https://api.github.com/users/openhab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openhab/openhab2-addons","description":"Add-ons for openHAB 2.x","fork":false,"url":"https://api.github.com/repos/openhab/openhab2-addons","forks_url":"https://api.github.com/repos/openhab/openhab2-addons/forks","keys_url":"https://api.github.com/repos/openhab/openhab2-addons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openhab/openhab2-addons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openhab/openhab2-addons/teams","hooks_url":"https://api.github.com/repos/openhab/openhab2-addons/hooks","issue_events_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/events{/number}","events_url":"https://api.github.com/repos/openhab/openhab2-addons/events","assignees_url":"https://api.github.com/repos/openhab/openhab2-addons/assignees{/user}","branches_url":"https://api.github.com/repos/openhab/openhab2-addons/branches{/branch}","tags_url":"https://api.github.com/repos/openhab/openhab2-addons/tags","blobs_url":"https://api.github.com/repos/openhab/openhab2-addons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openhab/openhab2-addons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openhab/openhab2-addons/git/refs{/sha}","trees_url":"https://api.github.com/repos/openhab/openhab2-addons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openhab/openhab2-addons/statuses/{sha}","languages_url":"https://api.github.com/repos/openhab/openhab2-addons/languages","stargazers_url":"https://api.github.com/repos/openhab/openhab2-addons/stargazers","contributors_url":"https://api.github.com/repos/openhab/openhab2-addons/contributors","subscribers_url":"https://api.github.com/repos/openhab/openhab2-addons/subscribers","subscription_url":"https://api.github.com/repos/openhab/openhab2-addons/subscription","commits_url":"https://api.github.com/repos/openhab/openhab2-addons/commits{/sha}","git_commits_url":"https://api.github.com/repos/openhab/openhab2-addons/git/commits{/sha}","comments_url":"https://api.github.com/repos/openhab/openhab2-addons/comments{/number}","issue_comment_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/comments{/number}","contents_url":"https://api.github.com/repos/openhab/openhab2-addons/contents/{+path}","compare_url":"https://api.github.com/repos/openhab/openhab2-addons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openhab/openhab2-addons/merges","archive_url":"https://api.github.com/repos/openhab/openhab2-addons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openhab/openhab2-addons/downloads","issues_url":"https://api.github.com/repos/openhab/openhab2-addons/issues{/number}","pulls_url":"https://api.github.com/repos/openhab/openhab2-addons/pulls{/number}","milestones_url":"https://api.github.com/repos/openhab/openhab2-addons/milestones{/number}","notifications_url":"https://api.github.com/repos/openhab/openhab2-addons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openhab/openhab2-addons/labels{/name}","releases_url":"https://api.github.com/repos/openhab/openhab2-addons/releases{/id}","deployments_url":"https://api.github.com/repos/openhab/openhab2-addons/deployments","created_at":"2014-05-13T19:41:58Z","updated_at":"2017-11-06T21:14:54Z","pushed_at":"2017-11-08T14:37:00Z","git_url":"git://github.com/openhab/openhab2-addons.git","ssh_url":"git@github.com:openhab/openhab2-addons.git","clone_url":"https://github.com/openhab/openhab2-addons.git","svn_url":"https://github.com/openhab/openhab2-addons","homepage":"","size":262800,"stargazers_count":672,"watchers_count":672,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1200,"mirror_url":null,"archived":false,"open_issues_count":355,"forks":1200,"open_issues":355,"watchers":672,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815"},"html":{"href":"https://github.com/openhab/openhab2-addons/pull/2815"},"issue":{"href":"https://api.github.com/repos/openhab/openhab2-addons/issues/2815"},"comments":{"href":"https://api.github.com/repos/openhab/openhab2-addons/issues/2815/comments"},"review_comments":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815/comments"},"review_comment":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openhab/openhab2-addons/pulls/2815/commits"},"statuses":{"href":"https://api.github.com/repos/openhab/openhab2-addons/statuses/44c6846fe44ccf296ad722f052303ae091daa19e"}},"author_association":"NONE"}}
{"actor":{"display_login":"Hilbrand"}}