{"action":"created","comment":{"url":"https://api.github.com/repos/openhab/openhab/pulls/comments/43569236","id":43569236,"diff_hunk":"@@ -0,0 +1,298 @@\n+/**\n+ * Copyright (c) 2010-2015, openHAB.org and others.\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+package org.openhab.binding.tacmi.internal;\n+\n+import java.net.DatagramPacket;\n+import java.net.DatagramSocket;\n+import java.net.InetAddress;\n+import java.net.SocketException;\n+import java.net.UnknownHostException;\n+import java.util.Map;\n+\n+import org.openhab.binding.tacmi.TACmiBindingProvider;\n+import org.openhab.binding.tacmi.internal.message.AnalogMessage;\n+import org.openhab.binding.tacmi.internal.message.AnalogValue;\n+import org.openhab.binding.tacmi.internal.message.DigitalMessage;\n+\n+import org.apache.commons.lang.StringUtils;\n+import org.openhab.core.binding.AbstractActiveBinding;\n+import org.openhab.core.library.types.DecimalType;\n+import org.openhab.core.library.types.OnOffType;\n+import org.openhab.core.types.Command;\n+import org.openhab.core.types.State;\n+import org.osgi.framework.BundleContext;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+/**\n+ * Implement this class if you are going create an actively polling service like\n+ * querying a Website/Device.\n+ * \n+ * @author Timo Wendt\n+ * @since 1.7.0\n+ */\n+public class TACmiBinding extends AbstractActiveBinding<TACmiBindingProvider> {\n+\n+\tprivate static final Logger logger = LoggerFactory\n+\t\t\t.getLogger(TACmiBinding.class);\n+\n+\t/**\n+\t * The BundleContext. This is only valid when the bundle is ACTIVE. It is\n+\t * set in the activate() method and must not be accessed anymore once the\n+\t * deactivate() method was called or before activate() was called.\n+\t */\n+\tprivate BundleContext bundleContext;\n+\n+\t/**\n+\t * the refresh interval which is used to poll values from the TACmi server\n+\t * (optional, defaults to 60000ms)\n+\t */\n+\tprivate long refreshInterval = 1000;\n+\n+\t/**\n+\t * IP or hostname of the CMI This is set in the activate method\n+\t */\n+\tprivate String cmiAddress;\n+\n+\t/**\n+\t * Port the cmi is listening on and also sending to\n+\t */\n+\tprivate static int cmiPort = 5441;\n+\n+\t/**\n+\t * Connection socket\n+\t */\n+\tprivate DatagramSocket clientSocket = null;\n+\n+\tpublic TACmiBinding() {\n+\t}\n+\n+\t/**\n+\t * Called by the SCR to activate the component with its configuration read\n+\t * from CAS\n+\t * \n+\t * @param bundleContext\n+\t *            BundleContext of the Bundle that defines this component\n+\t * @param configuration\n+\t *            Configuration properties for this component obtained from the\n+\t *            ConfigAdmin service\n+\t */\n+\tpublic void activate(final BundleContext bundleContext,\n+\t\t\tfinal Map<String, Object> configuration) {\n+\t\tthis.bundleContext = bundleContext;\n+\n+\t\t// the configuration is guaranteed not to be null, because the component\n+\t\t// definition has the\n+\t\t// configuration-policy set to require. If set to 'optional' then the\n+\t\t// configuration may be null\n+\n+\t\t// to override the default refresh interval one has to add a\n+\t\t// parameter to openhab.cfg like <bindingName>:refresh=<intervalInMs>\n+\t\tString refreshIntervalString = (String) configuration.get(\"refresh\");\n+\t\tif (StringUtils.isNotBlank(refreshIntervalString)) {\n+\t\t\trefreshInterval = Long.parseLong(refreshIntervalString);\n+\t\t}\n+\n+\t\t// set cmiAddress from configuration\n+\t\tcmiAddress = (String) configuration.get(\"cmiAddress\");\n+\n+\t\t// read further config parameters here ...\n+\t\ttry {\n+\t\t\tclientSocket = new DatagramSocket(cmiPort);\n+\t\t} catch (SocketException e) {\n+\t\t\t// TODO Auto-generated catch block\n+\t\t\te.printStackTrace();\n+\t\t}\n+\n+\t\tsetProperlyConfigured(true);\n+\t}\n+\n+\t/**\n+\t * Called by the SCR when the configuration of a binding has been changed\n+\t * through the ConfigAdmin service.\n+\t * \n+\t * @param configuration\n+\t *            Updated configuration properties\n+\t */\n+\tpublic void modified(final Map<String, Object> configuration) {\n+\t\t// update the internal configuration accordingly\n+\t}","path":"bundles/binding/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBinding.java","position":125,"original_position":125,"commit_id":"2945afdad3953af55cac4101106927f89fa360a5","original_commit_id":"2945afdad3953af55cac4101106927f89fa360a5","user":{"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},"body":"remove method (and also it's declaration in ```binding.xml```","created_at":"2015-10-31T07:33:10Z","updated_at":"2015-10-31T07:33:10Z","html_url":"https://github.com/openhab/openhab/pull/2525#discussion_r43569236","pull_request_url":"https://api.github.com/repos/openhab/openhab/pulls/2525","_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab/pulls/comments/43569236"},"html":{"href":"https://github.com/openhab/openhab/pull/2525#discussion_r43569236"},"pull_request":{"href":"https://api.github.com/repos/openhab/openhab/pulls/2525"}}},"pull_request":{"url":"https://api.github.com/repos/openhab/openhab/pulls/2525","id":34492618,"html_url":"https://github.com/openhab/openhab/pull/2525","diff_url":"https://github.com/openhab/openhab/pull/2525.diff","patch_url":"https://github.com/openhab/openhab/pull/2525.patch","issue_url":"https://api.github.com/repos/openhab/openhab/issues/2525","number":2525,"state":"open","locked":false,"title":"Initial implementation of TACmi binding.","user":{"login":"twendt","id":2073890,"avatar_url":"https://avatars.githubusercontent.com/u/2073890?v=3","gravatar_id":"","url":"https://api.github.com/users/twendt","html_url":"https://github.com/twendt","followers_url":"https://api.github.com/users/twendt/followers","following_url":"https://api.github.com/users/twendt/following{/other_user}","gists_url":"https://api.github.com/users/twendt/gists{/gist_id}","starred_url":"https://api.github.com/users/twendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twendt/subscriptions","organizations_url":"https://api.github.com/users/twendt/orgs","repos_url":"https://api.github.com/users/twendt/repos","events_url":"https://api.github.com/users/twendt/events{/privacy}","received_events_url":"https://api.github.com/users/twendt/received_events","type":"User","site_admin":false},"body":"This is an initial release of a binding for the CMI from Technische Alternative.","created_at":"2015-04-30T19:27:23Z","updated_at":"2015-10-31T07:33:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e1087b324743686794f1da02a7921ffdc818146","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openhab/openhab/pulls/2525/commits","review_comments_url":"https://api.github.com/repos/openhab/openhab/pulls/2525/comments","review_comment_url":"https://api.github.com/repos/openhab/openhab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openhab/openhab/issues/2525/comments","statuses_url":"https://api.github.com/repos/openhab/openhab/statuses/2945afdad3953af55cac4101106927f89fa360a5","head":{"label":"twendt:tacmi_binding","ref":"tacmi_binding","sha":"2945afdad3953af55cac4101106927f89fa360a5","user":{"login":"twendt","id":2073890,"avatar_url":"https://avatars.githubusercontent.com/u/2073890?v=3","gravatar_id":"","url":"https://api.github.com/users/twendt","html_url":"https://github.com/twendt","followers_url":"https://api.github.com/users/twendt/followers","following_url":"https://api.github.com/users/twendt/following{/other_user}","gists_url":"https://api.github.com/users/twendt/gists{/gist_id}","starred_url":"https://api.github.com/users/twendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twendt/subscriptions","organizations_url":"https://api.github.com/users/twendt/orgs","repos_url":"https://api.github.com/users/twendt/repos","events_url":"https://api.github.com/users/twendt/events{/privacy}","received_events_url":"https://api.github.com/users/twendt/received_events","type":"User","site_admin":false},"repo":{"id":34604774,"name":"openhab","full_name":"twendt/openhab","owner":{"login":"twendt","id":2073890,"avatar_url":"https://avatars.githubusercontent.com/u/2073890?v=3","gravatar_id":"","url":"https://api.github.com/users/twendt","html_url":"https://github.com/twendt","followers_url":"https://api.github.com/users/twendt/followers","following_url":"https://api.github.com/users/twendt/following{/other_user}","gists_url":"https://api.github.com/users/twendt/gists{/gist_id}","starred_url":"https://api.github.com/users/twendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twendt/subscriptions","organizations_url":"https://api.github.com/users/twendt/orgs","repos_url":"https://api.github.com/users/twendt/repos","events_url":"https://api.github.com/users/twendt/events{/privacy}","received_events_url":"https://api.github.com/users/twendt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/twendt/openhab","description":"Source code of the open Home Automation Bus (openHAB)","fork":true,"url":"https://api.github.com/repos/twendt/openhab","forks_url":"https://api.github.com/repos/twendt/openhab/forks","keys_url":"https://api.github.com/repos/twendt/openhab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twendt/openhab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twendt/openhab/teams","hooks_url":"https://api.github.com/repos/twendt/openhab/hooks","issue_events_url":"https://api.github.com/repos/twendt/openhab/issues/events{/number}","events_url":"https://api.github.com/repos/twendt/openhab/events","assignees_url":"https://api.github.com/repos/twendt/openhab/assignees{/user}","branches_url":"https://api.github.com/repos/twendt/openhab/branches{/branch}","tags_url":"https://api.github.com/repos/twendt/openhab/tags","blobs_url":"https://api.github.com/repos/twendt/openhab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twendt/openhab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twendt/openhab/git/refs{/sha}","trees_url":"https://api.github.com/repos/twendt/openhab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twendt/openhab/statuses/{sha}","languages_url":"https://api.github.com/repos/twendt/openhab/languages","stargazers_url":"https://api.github.com/repos/twendt/openhab/stargazers","contributors_url":"https://api.github.com/repos/twendt/openhab/contributors","subscribers_url":"https://api.github.com/repos/twendt/openhab/subscribers","subscription_url":"https://api.github.com/repos/twendt/openhab/subscription","commits_url":"https://api.github.com/repos/twendt/openhab/commits{/sha}","git_commits_url":"https://api.github.com/repos/twendt/openhab/git/commits{/sha}","comments_url":"https://api.github.com/repos/twendt/openhab/comments{/number}","issue_comment_url":"https://api.github.com/repos/twendt/openhab/issues/comments{/number}","contents_url":"https://api.github.com/repos/twendt/openhab/contents/{+path}","compare_url":"https://api.github.com/repos/twendt/openhab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twendt/openhab/merges","archive_url":"https://api.github.com/repos/twendt/openhab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twendt/openhab/downloads","issues_url":"https://api.github.com/repos/twendt/openhab/issues{/number}","pulls_url":"https://api.github.com/repos/twendt/openhab/pulls{/number}","milestones_url":"https://api.github.com/repos/twendt/openhab/milestones{/number}","notifications_url":"https://api.github.com/repos/twendt/openhab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twendt/openhab/labels{/name}","releases_url":"https://api.github.com/repos/twendt/openhab/releases{/id}","created_at":"2015-04-26T08:59:44Z","updated_at":"2015-04-26T08:59:56Z","pushed_at":"2015-04-30T19:23:57Z","git_url":"git://github.com/twendt/openhab.git","ssh_url":"git@github.com:twendt/openhab.git","clone_url":"https://github.com/twendt/openhab.git","svn_url":"https://github.com/twendt/openhab","homepage":null,"size":152584,"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":"6be669a789ac6d0302a1034de15717fbab204adb","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}","created_at":"2013-09-20T20:28:43Z","updated_at":"2015-10-30T21:41:32Z","pushed_at":"2015-10-31T06:48:46Z","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":296770,"stargazers_count":1790,"watchers_count":1790,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1008,"mirror_url":null,"open_issues_count":506,"forks":1008,"open_issues":506,"watchers":1790,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab/pulls/2525"},"html":{"href":"https://github.com/openhab/openhab/pull/2525"},"issue":{"href":"https://api.github.com/repos/openhab/openhab/issues/2525"},"comments":{"href":"https://api.github.com/repos/openhab/openhab/issues/2525/comments"},"review_comments":{"href":"https://api.github.com/repos/openhab/openhab/pulls/2525/comments"},"review_comment":{"href":"https://api.github.com/repos/openhab/openhab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openhab/openhab/pulls/2525/commits"},"statuses":{"href":"https://api.github.com/repos/openhab/openhab/statuses/2945afdad3953af55cac4101106927f89fa360a5"}}}}