{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/liota/pulls/comments/86664366","pull_request_review_id":7313879,"id":86664366,"diff_hunk":"@@ -0,0 +1,170 @@\n+# -*- coding: utf-8 -*-\n+# ----------------------------------------------------------------------------#\n+#  Copyright © 2015-2016 VMware, Inc. All Rights Reserved.                    #\n+#                                                                             #\n+#  Licensed under the BSD 2-Clause License (the “License”); you may not use   #\n+#  this file except in compliance with the License.                           #\n+#                                                                             #\n+#  The BSD 2-Clause License                                                   #\n+#                                                                             #\n+#  Redistribution and use in source and binary forms, with or without         #\n+#  modification, are permitted provided that the following conditions are met:#\n+#                                                                             #\n+#  - Redistributions of source code must retain the above copyright notice,   #\n+#      this list of conditions and the following disclaimer.                  #\n+#                                                                             #\n+#  - Redistributions in binary form must reproduce the above copyright        #\n+#      notice, this list of conditions and the following disclaimer in the    #\n+#      documentation and/or other materials provided with the distribution.   #\n+#                                                                             #\n+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"#\n+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  #\n+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE #\n+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE  #\n+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR        #\n+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF       #\n+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS   #\n+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN    #\n+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)    #\n+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF     #\n+#  THE POSSIBILITY OF SUCH DAMAGE.                                            #\n+# ----------------------------------------------------------------------------#\n+from liota.device_comms.mqtt_device_comms import MqttDeviceComms\n+from liota.lib.identity.edge_system_identity import Identity\n+from liota.lib.identity.tls_conf import TLSConf\n+from liota.lib.transports.mqtt import QoSDetails\n+from liota.dccs.iotcc import IotControlCenter\n+from liota.dcc_comms.websocket_dcc_comms import WebSocketDccComms\n+from liota.entities.edge_systems.dk300_edge_system import Dk300EdgeSystem\n+from liota.entities.devices.simulated_device import SimulatedDevice\n+from liota.entities.metrics.metric import Metric\n+from liota.dccs.dcc import RegistrationFailure\n+\n+import Queue\n+import pint\n+\n+# getting values from conf file\n+config = {}\n+execfile('sampleProp.conf', config)\n+\n+# Create unit registry\n+ureg = pint.UnitRegistry()\n+\n+# Store temperature values in Queue\n+kitchen_temperature_data = Queue.Queue()\n+living_room_temperature_data = Queue.Queue()\n+\n+\n+# Callback functions\n+# To put corresponding values in queue\n+def callback_kitchen_temp(client, userdata, message):\n+    kitchen_temperature_data.put(float(message.payload))\n+\n+\n+def callback_living_room_temp(client, userdata, message):\n+    living_room_temperature_data.put(float(message.payload))\n+\n+\n+# Extract data from Queue\n+def get_value(queue):\n+    return queue.get(block=True)\n+\n+# ------------------------------------------------------------------------------------\n+# In this example, we demonstrate how data streaming can be done from MQTT channel\n+# to IoTCC using LIOTA setting sampling_interval_sec to zero.\n+# Here we have two different temperature sensors for two rooms (kitchen and living)\n+# Temperature values from sensor will be collected using MQTT channel and redirected\n+# to IoTCC data center component\n+# ------------------------------------------------------------------------------------\n+if __name__ == \"__main__\":\n+\n+    # Create DCC object IoTCC using websocket transport\n+    # with UID and PASS\n+    iotcc = IotControlCenter(config['IotCCUID'], config['IotCCPassword'],\n+                             WebSocketDccComms(url=config['WebSocketUrl']))\n+\n+    try:\n+        # Create Edge System identity object with all required certificate details\n+        # To connect with a TLS enabled MQTT broker\n+        edge_system_identity = Identity(config['cacert'], config['certfile'], config['keyfile'], config['mqtt_username'],\n+                               config['mqtt_password'])\n+\n+        # Encapsulate TLS parameters","path":"examples/iotcc_mqtt.py","position":92,"original_position":92,"commit_id":"408bb98ce196c0cc1a17e5cb94b177b696f15141","original_commit_id":"408bb98ce196c0cc1a17e5cb94b177b696f15141","user":{"login":"Venkat2811","id":10533729,"avatar_url":"https://avatars.githubusercontent.com/u/10533729?v=3","gravatar_id":"","url":"https://api.github.com/users/Venkat2811","html_url":"https://github.com/Venkat2811","followers_url":"https://api.github.com/users/Venkat2811/followers","following_url":"https://api.github.com/users/Venkat2811/following{/other_user}","gists_url":"https://api.github.com/users/Venkat2811/gists{/gist_id}","starred_url":"https://api.github.com/users/Venkat2811/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Venkat2811/subscriptions","organizations_url":"https://api.github.com/users/Venkat2811/orgs","repos_url":"https://api.github.com/users/Venkat2811/repos","events_url":"https://api.github.com/users/Venkat2811/events{/privacy}","received_events_url":"https://api.github.com/users/Venkat2811/received_events","type":"User","site_admin":false},"body":"Okay","created_at":"2016-11-05T13:06:58Z","updated_at":"2016-11-05T13:06:58Z","html_url":"https://github.com/vmware/liota/pull/48#discussion_r86664366","pull_request_url":"https://api.github.com/repos/vmware/liota/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/vmware/liota/pulls/comments/86664366"},"html":{"href":"https://github.com/vmware/liota/pull/48#discussion_r86664366"},"pull_request":{"href":"https://api.github.com/repos/vmware/liota/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/liota/pulls/48","id":89376865,"html_url":"https://github.com/vmware/liota/pull/48","diff_url":"https://github.com/vmware/liota/pull/48.diff","patch_url":"https://github.com/vmware/liota/pull/48.patch","issue_url":"https://api.github.com/repos/vmware/liota/issues/48","number":48,"state":"open","locked":false,"title":"MQTT Transport Implementation","user":{"login":"Venkat2811","id":10533729,"avatar_url":"https://avatars.githubusercontent.com/u/10533729?v=3","gravatar_id":"","url":"https://api.github.com/users/Venkat2811","html_url":"https://github.com/Venkat2811","followers_url":"https://api.github.com/users/Venkat2811/followers","following_url":"https://api.github.com/users/Venkat2811/following{/other_user}","gists_url":"https://api.github.com/users/Venkat2811/gists{/gist_id}","starred_url":"https://api.github.com/users/Venkat2811/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Venkat2811/subscriptions","organizations_url":"https://api.github.com/users/Venkat2811/orgs","repos_url":"https://api.github.com/users/Venkat2811/repos","events_url":"https://api.github.com/users/Venkat2811/events{/privacy}","received_events_url":"https://api.github.com/users/Venkat2811/received_events","type":"User","site_admin":false},"body":"- Added edge system identity layer for encapsulating gateway details\n\n`MQTT Transport Implementation :`\n- TLS Implementation\n- Username/Password based authentication\n- QoS 0, 1, 2 support\n- Mqtt Device and Dcc comms\n- Example with reference to Vaibhav's [example.](https://github.com/KohliDev/liota/blob/235ae8848a5d31794e9ddf71c87a2cb9edad961d/example/vrops_mqtt.py)\n","created_at":"2016-10-14T12:36:08Z","updated_at":"2016-11-05T13:06:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d2523439d7aa8d47810e7164145938705dae884","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vmware/liota/pulls/48/commits","review_comments_url":"https://api.github.com/repos/vmware/liota/pulls/48/comments","review_comment_url":"https://api.github.com/repos/vmware/liota/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/liota/issues/48/comments","statuses_url":"https://api.github.com/repos/vmware/liota/statuses/408bb98ce196c0cc1a17e5cb94b177b696f15141","head":{"label":"diwanc:mqtt","ref":"mqtt","sha":"408bb98ce196c0cc1a17e5cb94b177b696f15141","user":{"login":"diwanc","id":4242007,"avatar_url":"https://avatars.githubusercontent.com/u/4242007?v=3","gravatar_id":"","url":"https://api.github.com/users/diwanc","html_url":"https://github.com/diwanc","followers_url":"https://api.github.com/users/diwanc/followers","following_url":"https://api.github.com/users/diwanc/following{/other_user}","gists_url":"https://api.github.com/users/diwanc/gists{/gist_id}","starred_url":"https://api.github.com/users/diwanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diwanc/subscriptions","organizations_url":"https://api.github.com/users/diwanc/orgs","repos_url":"https://api.github.com/users/diwanc/repos","events_url":"https://api.github.com/users/diwanc/events{/privacy}","received_events_url":"https://api.github.com/users/diwanc/received_events","type":"User","site_admin":false},"repo":{"id":64391850,"name":"liota","full_name":"diwanc/liota","owner":{"login":"diwanc","id":4242007,"avatar_url":"https://avatars.githubusercontent.com/u/4242007?v=3","gravatar_id":"","url":"https://api.github.com/users/diwanc","html_url":"https://github.com/diwanc","followers_url":"https://api.github.com/users/diwanc/followers","following_url":"https://api.github.com/users/diwanc/following{/other_user}","gists_url":"https://api.github.com/users/diwanc/gists{/gist_id}","starred_url":"https://api.github.com/users/diwanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diwanc/subscriptions","organizations_url":"https://api.github.com/users/diwanc/orgs","repos_url":"https://api.github.com/users/diwanc/repos","events_url":"https://api.github.com/users/diwanc/events{/privacy}","received_events_url":"https://api.github.com/users/diwanc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/diwanc/liota","description":null,"fork":true,"url":"https://api.github.com/repos/diwanc/liota","forks_url":"https://api.github.com/repos/diwanc/liota/forks","keys_url":"https://api.github.com/repos/diwanc/liota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diwanc/liota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diwanc/liota/teams","hooks_url":"https://api.github.com/repos/diwanc/liota/hooks","issue_events_url":"https://api.github.com/repos/diwanc/liota/issues/events{/number}","events_url":"https://api.github.com/repos/diwanc/liota/events","assignees_url":"https://api.github.com/repos/diwanc/liota/assignees{/user}","branches_url":"https://api.github.com/repos/diwanc/liota/branches{/branch}","tags_url":"https://api.github.com/repos/diwanc/liota/tags","blobs_url":"https://api.github.com/repos/diwanc/liota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diwanc/liota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diwanc/liota/git/refs{/sha}","trees_url":"https://api.github.com/repos/diwanc/liota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diwanc/liota/statuses/{sha}","languages_url":"https://api.github.com/repos/diwanc/liota/languages","stargazers_url":"https://api.github.com/repos/diwanc/liota/stargazers","contributors_url":"https://api.github.com/repos/diwanc/liota/contributors","subscribers_url":"https://api.github.com/repos/diwanc/liota/subscribers","subscription_url":"https://api.github.com/repos/diwanc/liota/subscription","commits_url":"https://api.github.com/repos/diwanc/liota/commits{/sha}","git_commits_url":"https://api.github.com/repos/diwanc/liota/git/commits{/sha}","comments_url":"https://api.github.com/repos/diwanc/liota/comments{/number}","issue_comment_url":"https://api.github.com/repos/diwanc/liota/issues/comments{/number}","contents_url":"https://api.github.com/repos/diwanc/liota/contents/{+path}","compare_url":"https://api.github.com/repos/diwanc/liota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diwanc/liota/merges","archive_url":"https://api.github.com/repos/diwanc/liota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diwanc/liota/downloads","issues_url":"https://api.github.com/repos/diwanc/liota/issues{/number}","pulls_url":"https://api.github.com/repos/diwanc/liota/pulls{/number}","milestones_url":"https://api.github.com/repos/diwanc/liota/milestones{/number}","notifications_url":"https://api.github.com/repos/diwanc/liota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diwanc/liota/labels{/name}","releases_url":"https://api.github.com/repos/diwanc/liota/releases{/id}","deployments_url":"https://api.github.com/repos/diwanc/liota/deployments","created_at":"2016-07-28T11:58:52Z","updated_at":"2016-07-28T11:58:53Z","pushed_at":"2016-10-28T10:34:01Z","git_url":"git://github.com/diwanc/liota.git","ssh_url":"git@github.com:diwanc/liota.git","clone_url":"https://github.com/diwanc/liota.git","svn_url":"https://github.com/diwanc/liota","homepage":null,"size":461,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"vmware:master","ref":"master","sha":"6673ee7b57eccfbbb00290d23acaf24cd0a5cd6a","user":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"repo":{"id":51544954,"name":"liota","full_name":"vmware/liota","owner":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vmware/liota","description":null,"fork":false,"url":"https://api.github.com/repos/vmware/liota","forks_url":"https://api.github.com/repos/vmware/liota/forks","keys_url":"https://api.github.com/repos/vmware/liota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/liota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/liota/teams","hooks_url":"https://api.github.com/repos/vmware/liota/hooks","issue_events_url":"https://api.github.com/repos/vmware/liota/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/liota/events","assignees_url":"https://api.github.com/repos/vmware/liota/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/liota/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/liota/tags","blobs_url":"https://api.github.com/repos/vmware/liota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/liota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/liota/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/liota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/liota/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/liota/languages","stargazers_url":"https://api.github.com/repos/vmware/liota/stargazers","contributors_url":"https://api.github.com/repos/vmware/liota/contributors","subscribers_url":"https://api.github.com/repos/vmware/liota/subscribers","subscription_url":"https://api.github.com/repos/vmware/liota/subscription","commits_url":"https://api.github.com/repos/vmware/liota/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/liota/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/liota/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/liota/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/liota/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/liota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/liota/merges","archive_url":"https://api.github.com/repos/vmware/liota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/liota/downloads","issues_url":"https://api.github.com/repos/vmware/liota/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/liota/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/liota/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/liota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/liota/labels{/name}","releases_url":"https://api.github.com/repos/vmware/liota/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/liota/deployments","created_at":"2016-02-11T20:31:26Z","updated_at":"2016-11-02T07:57:13Z","pushed_at":"2016-10-26T04:38:54Z","git_url":"git://github.com/vmware/liota.git","ssh_url":"git@github.com:vmware/liota.git","clone_url":"https://github.com/vmware/liota.git","svn_url":"https://github.com/vmware/liota","homepage":null,"size":415,"stargazers_count":187,"watchers_count":187,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":6,"forks":57,"open_issues":6,"watchers":187,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/liota/pulls/48"},"html":{"href":"https://github.com/vmware/liota/pull/48"},"issue":{"href":"https://api.github.com/repos/vmware/liota/issues/48"},"comments":{"href":"https://api.github.com/repos/vmware/liota/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/liota/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/liota/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/liota/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/liota/statuses/408bb98ce196c0cc1a17e5cb94b177b696f15141"}}}}
{"actor":{"display_login":"Venkat2811"}}