{"action":"created","comment":{"url":"https://api.github.com/repos/openhab/openhab/pulls/comments/94271439","pull_request_review_id":14802187,"id":94271439,"diff_hunk":"@@ -276,13 +285,77 @@ private void handlePortState() {\n      * Switch the Serial Port speed (LOW --> HIGH and vice versa).\n      */\n     private void switchPortSpeed() {\n-        switch (portSpeed) {\n-            case HIGH_SPEED:\n-                portSpeed = PortSpeed.LOW_SPEED;\n-                break;\n-            case LOW_SPEED:\n-                portSpeed = PortSpeed.HIGH_SPEED;\n-                break;\n+        if (fixedPortSettings == null) {\n+            logger.debug(\"No fixed port setting (autodetect ENABLED), switch between specification standard settings\");\n+\n+            // Checking instance reference here since these are final\n+            if (portSettings == DSMRPortSettings.HIGH_SPEED_SETTINGS) {\n+                portSettings = DSMRPortSettings.LOW_SPEED_SETTINGS;\n+            } else {\n+                portSettings = DSMRPortSettings.HIGH_SPEED_SETTINGS;\n+            }\n+            logger.debug(\"Switched port settings to:\" + portSettings);\n+        } else {\n+            portSettings = fixedPortSettings;\n+            logger.info(\"Fixed port settings configured (autodetect DISABLED):\" + portSettings);\n+        }\n+    }\n+\n+    /**\n+     * Checks if the given port name is autodetected by gnu.io or already listed\n+     * in the system property gnu.io.rxtx.SerialPorts\n+     *\n+     * @param portName String containing the port name to lookup\n+     * @return true if port exists, false otherwise\n+     */\n+    private boolean portExists(String portName) {\n+        @SuppressWarnings(\"unchecked\")\n+        Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers();\n+\n+        boolean portExists = false;\n+\n+        logger.debug(\"Searching autodetected ports for:\" + portName);\n+        while (portEnum.hasMoreElements()) {\n+            CommPortIdentifier portIdentifier = portEnum.nextElement();\n+            if (portIdentifier.getPortType() == CommPortIdentifier.PORT_SERIAL) {\n+                logger.debug(\"Found serial port:\" + portIdentifier.getName());\n+                if (portIdentifier.getName().equals(portName)) {\n+                    portExists = true;\n+                }\n+            }\n+        }\n+        if (!portExists) {\n+            Properties properties = System.getProperties();\n+            String currentPorts = properties.getProperty(\"gnu.io.rxtx.SerialPorts\", \"\");\n+            if (currentPorts.indexOf(portName) >= 0) {\n+                logger.debug(portName + \" is listed in system property gnu.io.rxtx.SerialPorts\");","path":"bundles/binding/org.openhab.binding.dsmr/src/main/java/org/openhab/binding/dsmr/internal/DSMRPort.java","position":null,"original_position":148,"commit_id":"427b4d7a2033ed50f217d2b210c139f86116e69b","original_commit_id":"1654c8189559bebead5c77964624d05aa21706dc","user":{"login":"mvolaart","id":10352372,"avatar_url":"https://avatars.githubusercontent.com/u/10352372?v=3","gravatar_id":"","url":"https://api.github.com/users/mvolaart","html_url":"https://github.com/mvolaart","followers_url":"https://api.github.com/users/mvolaart/followers","following_url":"https://api.github.com/users/mvolaart/following{/other_user}","gists_url":"https://api.github.com/users/mvolaart/gists{/gist_id}","starred_url":"https://api.github.com/users/mvolaart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvolaart/subscriptions","organizations_url":"https://api.github.com/users/mvolaart/orgs","repos_url":"https://api.github.com/users/mvolaart/repos","events_url":"https://api.github.com/users/mvolaart/events{/privacy}","received_events_url":"https://api.github.com/users/mvolaart/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-12-31T09:47:27Z","updated_at":"2016-12-31T09:47:27Z","html_url":"https://github.com/openhab/openhab/pull/4854#discussion_r94271439","pull_request_url":"https://api.github.com/repos/openhab/openhab/pulls/4854","_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab/pulls/comments/94271439"},"html":{"href":"https://github.com/openhab/openhab/pull/4854#discussion_r94271439"},"pull_request":{"href":"https://api.github.com/repos/openhab/openhab/pulls/4854"}}},"pull_request":{"url":"https://api.github.com/repos/openhab/openhab/pulls/4854","id":96387483,"html_url":"https://github.com/openhab/openhab/pull/4854","diff_url":"https://github.com/openhab/openhab/pull/4854.diff","patch_url":"https://github.com/openhab/openhab/pull/4854.patch","issue_url":"https://api.github.com/repos/openhab/openhab/issues/4854","number":4854,"state":"open","locked":false,"title":"[dsmr] Fixes for issue #4175 and #4792","user":{"login":"mvolaart","id":10352372,"avatar_url":"https://avatars.githubusercontent.com/u/10352372?v=3","gravatar_id":"","url":"https://api.github.com/users/mvolaart","html_url":"https://github.com/mvolaart","followers_url":"https://api.github.com/users/mvolaart/followers","following_url":"https://api.github.com/users/mvolaart/following{/other_user}","gists_url":"https://api.github.com/users/mvolaart/gists{/gist_id}","starred_url":"https://api.github.com/users/mvolaart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvolaart/subscriptions","organizations_url":"https://api.github.com/users/mvolaart/orgs","repos_url":"https://api.github.com/users/mvolaart/repos","events_url":"https://api.github.com/users/mvolaart/events{/privacy}","received_events_url":"https://api.github.com/users/mvolaart/received_events","type":"User","site_admin":false},"body":"- Added DSMR port settings (fixes issue #4175)\r\n- Quicker poll rate (fixes issue #4792 - overflow)\r\n- Added actual voltage messages (fixes issue #4792 - unsupported\r\nmessages)","created_at":"2016-12-03T05:29:44Z","updated_at":"2016-12-31T09:47:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e8e187afc626942ecaedfff962dd2d82724be36","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/openhab/openhab/milestones/12","html_url":"https://github.com/openhab/openhab/milestone/12","labels_url":"https://api.github.com/repos/openhab/openhab/milestones/12/labels","id":1479830,"number":12,"title":"1.9.0","description":"","creator":{"login":"teichsta","id":2108636,"avatar_url":"https://avatars.githubusercontent.com/u/2108636?v=3","gravatar_id":"","url":"https://api.github.com/users/teichsta","html_url":"https://github.com/teichsta","followers_url":"https://api.github.com/users/teichsta/followers","following_url":"https://api.github.com/users/teichsta/following{/other_user}","gists_url":"https://api.github.com/users/teichsta/gists{/gist_id}","starred_url":"https://api.github.com/users/teichsta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teichsta/subscriptions","organizations_url":"https://api.github.com/users/teichsta/orgs","repos_url":"https://api.github.com/users/teichsta/repos","events_url":"https://api.github.com/users/teichsta/events{/privacy}","received_events_url":"https://api.github.com/users/teichsta/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":363,"state":"open","created_at":"2016-01-01T16:37:00Z","updated_at":"2016-12-30T12:17:15Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/openhab/openhab/pulls/4854/commits","review_comments_url":"https://api.github.com/repos/openhab/openhab/pulls/4854/comments","review_comment_url":"https://api.github.com/repos/openhab/openhab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openhab/openhab/issues/4854/comments","statuses_url":"https://api.github.com/repos/openhab/openhab/statuses/427b4d7a2033ed50f217d2b210c139f86116e69b","head":{"label":"mvolaart:master","ref":"master","sha":"427b4d7a2033ed50f217d2b210c139f86116e69b","user":{"login":"mvolaart","id":10352372,"avatar_url":"https://avatars.githubusercontent.com/u/10352372?v=3","gravatar_id":"","url":"https://api.github.com/users/mvolaart","html_url":"https://github.com/mvolaart","followers_url":"https://api.github.com/users/mvolaart/followers","following_url":"https://api.github.com/users/mvolaart/following{/other_user}","gists_url":"https://api.github.com/users/mvolaart/gists{/gist_id}","starred_url":"https://api.github.com/users/mvolaart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvolaart/subscriptions","organizations_url":"https://api.github.com/users/mvolaart/orgs","repos_url":"https://api.github.com/users/mvolaart/repos","events_url":"https://api.github.com/users/mvolaart/events{/privacy}","received_events_url":"https://api.github.com/users/mvolaart/received_events","type":"User","site_admin":false},"repo":{"id":28644031,"name":"openhab","full_name":"mvolaart/openhab","owner":{"login":"mvolaart","id":10352372,"avatar_url":"https://avatars.githubusercontent.com/u/10352372?v=3","gravatar_id":"","url":"https://api.github.com/users/mvolaart","html_url":"https://github.com/mvolaart","followers_url":"https://api.github.com/users/mvolaart/followers","following_url":"https://api.github.com/users/mvolaart/following{/other_user}","gists_url":"https://api.github.com/users/mvolaart/gists{/gist_id}","starred_url":"https://api.github.com/users/mvolaart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvolaart/subscriptions","organizations_url":"https://api.github.com/users/mvolaart/orgs","repos_url":"https://api.github.com/users/mvolaart/repos","events_url":"https://api.github.com/users/mvolaart/events{/privacy}","received_events_url":"https://api.github.com/users/mvolaart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mvolaart/openhab","description":"Source code of the open Home Automation Bus (openHAB)","fork":true,"url":"https://api.github.com/repos/mvolaart/openhab","forks_url":"https://api.github.com/repos/mvolaart/openhab/forks","keys_url":"https://api.github.com/repos/mvolaart/openhab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mvolaart/openhab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mvolaart/openhab/teams","hooks_url":"https://api.github.com/repos/mvolaart/openhab/hooks","issue_events_url":"https://api.github.com/repos/mvolaart/openhab/issues/events{/number}","events_url":"https://api.github.com/repos/mvolaart/openhab/events","assignees_url":"https://api.github.com/repos/mvolaart/openhab/assignees{/user}","branches_url":"https://api.github.com/repos/mvolaart/openhab/branches{/branch}","tags_url":"https://api.github.com/repos/mvolaart/openhab/tags","blobs_url":"https://api.github.com/repos/mvolaart/openhab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mvolaart/openhab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mvolaart/openhab/git/refs{/sha}","trees_url":"https://api.github.com/repos/mvolaart/openhab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mvolaart/openhab/statuses/{sha}","languages_url":"https://api.github.com/repos/mvolaart/openhab/languages","stargazers_url":"https://api.github.com/repos/mvolaart/openhab/stargazers","contributors_url":"https://api.github.com/repos/mvolaart/openhab/contributors","subscribers_url":"https://api.github.com/repos/mvolaart/openhab/subscribers","subscription_url":"https://api.github.com/repos/mvolaart/openhab/subscription","commits_url":"https://api.github.com/repos/mvolaart/openhab/commits{/sha}","git_commits_url":"https://api.github.com/repos/mvolaart/openhab/git/commits{/sha}","comments_url":"https://api.github.com/repos/mvolaart/openhab/comments{/number}","issue_comment_url":"https://api.github.com/repos/mvolaart/openhab/issues/comments{/number}","contents_url":"https://api.github.com/repos/mvolaart/openhab/contents/{+path}","compare_url":"https://api.github.com/repos/mvolaart/openhab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mvolaart/openhab/merges","archive_url":"https://api.github.com/repos/mvolaart/openhab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mvolaart/openhab/downloads","issues_url":"https://api.github.com/repos/mvolaart/openhab/issues{/number}","pulls_url":"https://api.github.com/repos/mvolaart/openhab/pulls{/number}","milestones_url":"https://api.github.com/repos/mvolaart/openhab/milestones{/number}","notifications_url":"https://api.github.com/repos/mvolaart/openhab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mvolaart/openhab/labels{/name}","releases_url":"https://api.github.com/repos/mvolaart/openhab/releases{/id}","deployments_url":"https://api.github.com/repos/mvolaart/openhab/deployments","created_at":"2014-12-30T20:18:18Z","updated_at":"2016-11-20T20:30:45Z","pushed_at":"2016-12-23T19:55:28Z","git_url":"git://github.com/mvolaart/openhab.git","ssh_url":"git@github.com:mvolaart/openhab.git","clone_url":"https://github.com/mvolaart/openhab.git","svn_url":"https://github.com/mvolaart/openhab","homepage":null,"size":214155,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"openhab:master","ref":"master","sha":"f571b93852ed40c0fd54228f208260e790244e38","user":{"login":"openhab","id":1007353,"avatar_url":"https://avatars.githubusercontent.com/u/1007353?v=3","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":12983151,"name":"openhab","full_name":"openhab/openhab","owner":{"login":"openhab","id":1007353,"avatar_url":"https://avatars.githubusercontent.com/u/1007353?v=3","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/openhab","description":"Source code of the open Home Automation Bus (openHAB)","fork":false,"url":"https://api.github.com/repos/openhab/openhab","forks_url":"https://api.github.com/repos/openhab/openhab/forks","keys_url":"https://api.github.com/repos/openhab/openhab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openhab/openhab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openhab/openhab/teams","hooks_url":"https://api.github.com/repos/openhab/openhab/hooks","issue_events_url":"https://api.github.com/repos/openhab/openhab/issues/events{/number}","events_url":"https://api.github.com/repos/openhab/openhab/events","assignees_url":"https://api.github.com/repos/openhab/openhab/assignees{/user}","branches_url":"https://api.github.com/repos/openhab/openhab/branches{/branch}","tags_url":"https://api.github.com/repos/openhab/openhab/tags","blobs_url":"https://api.github.com/repos/openhab/openhab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openhab/openhab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openhab/openhab/git/refs{/sha}","trees_url":"https://api.github.com/repos/openhab/openhab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openhab/openhab/statuses/{sha}","languages_url":"https://api.github.com/repos/openhab/openhab/languages","stargazers_url":"https://api.github.com/repos/openhab/openhab/stargazers","contributors_url":"https://api.github.com/repos/openhab/openhab/contributors","subscribers_url":"https://api.github.com/repos/openhab/openhab/subscribers","subscription_url":"https://api.github.com/repos/openhab/openhab/subscription","commits_url":"https://api.github.com/repos/openhab/openhab/commits{/sha}","git_commits_url":"https://api.github.com/repos/openhab/openhab/git/commits{/sha}","comments_url":"https://api.github.com/repos/openhab/openhab/comments{/number}","issue_comment_url":"https://api.github.com/repos/openhab/openhab/issues/comments{/number}","contents_url":"https://api.github.com/repos/openhab/openhab/contents/{+path}","compare_url":"https://api.github.com/repos/openhab/openhab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openhab/openhab/merges","archive_url":"https://api.github.com/repos/openhab/openhab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openhab/openhab/downloads","issues_url":"https://api.github.com/repos/openhab/openhab/issues{/number}","pulls_url":"https://api.github.com/repos/openhab/openhab/pulls{/number}","milestones_url":"https://api.github.com/repos/openhab/openhab/milestones{/number}","notifications_url":"https://api.github.com/repos/openhab/openhab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openhab/openhab/labels{/name}","releases_url":"https://api.github.com/repos/openhab/openhab/releases{/id}","deployments_url":"https://api.github.com/repos/openhab/openhab/deployments","created_at":"2013-09-20T20:28:43Z","updated_at":"2016-12-31T07:07:58Z","pushed_at":"2016-12-31T02:20:38Z","git_url":"git://github.com/openhab/openhab.git","ssh_url":"git@github.com:openhab/openhab.git","clone_url":"https://github.com/openhab/openhab.git","svn_url":"https://github.com/openhab/openhab","homepage":null,"size":220006,"stargazers_count":3354,"watchers_count":3354,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1554,"mirror_url":null,"open_issues_count":283,"forks":1554,"open_issues":283,"watchers":3354,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab/pulls/4854"},"html":{"href":"https://github.com/openhab/openhab/pull/4854"},"issue":{"href":"https://api.github.com/repos/openhab/openhab/issues/4854"},"comments":{"href":"https://api.github.com/repos/openhab/openhab/issues/4854/comments"},"review_comments":{"href":"https://api.github.com/repos/openhab/openhab/pulls/4854/comments"},"review_comment":{"href":"https://api.github.com/repos/openhab/openhab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openhab/openhab/pulls/4854/commits"},"statuses":{"href":"https://api.github.com/repos/openhab/openhab/statuses/427b4d7a2033ed50f217d2b210c139f86116e69b"}}}}
{"actor":{"display_login":"mvolaart"}}