{"id":183095,"date":"2021-05-30T07:53:31","date_gmt":"2021-05-30T14:53:31","guid":{"rendered":"https:\/\/m2msupport.net\/m2msupport\/?page_id=183095"},"modified":"2021-05-30T07:54:06","modified_gmt":"2021-05-30T14:54:06","slug":"publish-without-gateway-through-mqtt-bridge-in-google-cloud-platform-gcp","status":"publish","type":"page","link":"https:\/\/m2msupport.net\/m2msupport\/publish-without-gateway-through-mqtt-bridge-in-google-cloud-platform-gcp\/","title":{"rendered":"Publish without gateway to MQTT bridge in Google Cloud Platform (GCP)"},"content":{"rendered":"<p>Devices send data to Google Cloud Platform by publishing to the&nbsp;Message Queue Telemetry Transport (MQTT) bridge in the Google Cloud Platform.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/download-iot-cloud-tester\/\">IoT Cloud Tester<\/a>&nbsp; application provides an easy interface publish data to the Google Cloud Platform (GCP).<\/p>\n<h1>To publish without gateway to MQTT bridge in GCP,<\/h1>\n<ul>\n<li><a href=\"https:\/\/m2msupport.net\/m2msupport\/add-a-device-in-google-cloud-platform-gcp-using-iot-cloud-tester\/\">Add a device to the device registry<\/a> in GCP<\/li>\n<li>In the &#8216;Publish&#8217; tab, get the list of devices in the given region\/registry from GCP.<\/li>\n<li>Select the topic.<\/li>\n<li>Configure the MQTT server address and the port. Google&#8217;s MQTT server address is mqtt.googleapis.com and the port is 8883.<\/li>\n<li>Configure the Frequency &#8211; how often the device will publish the data and the Count &#8211; number of times the data will be published. Random data will be generated by the IoT Cloud Tester tool based on the data model associated with&nbsp; the device.<\/li>\n<li>Click the &#8216;Pub\/Sub Monitor&#8217; button to open the window to monitor the data published by the device.<\/li>\n<li>Click on the &#8216;Publish&#8217; button to start publishing data for the selected device(s). Note that the IoT Cloud Tester enables publishing by multiple devices at the same time.<\/li>\n<\/ul>\n<p>In this below example, device &#8216;dev_41799&#8217; is not bound to any gateway. The device establishes the connection to the MQTT bridge and publishes data directly without going through any gateway device.<\/p>\n<p>The device is associated to the data model called &#8216;device-data&#8217; which has temperature and humidity as the data fields. The IoT Cloud Tester application will generate random data to publish based on the constraints defined for the fields in the model.<\/p>\n<p>The data will be published to &#8216;device_environment&#8217; topic on the GCP. So any subscribers to that topic will receive the data published by the device.<\/p>\n<p>The device will publish every 10 seconds (Frequency) for 5 times (Count).<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-183097\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway.png\" alt=\"\" width=\"849\" height=\"737\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway.png 849w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway-300x260.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway-768x667.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_no_gateway-600x521.png 600w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/a><\/p>\n<p>The Pub\/Sub monitor will show the data published by the devices.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-183098\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway.png\" alt=\"\" width=\"830\" height=\"651\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway.png 830w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway-300x235.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway-768x602.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/pub_sub_monitor_no_gateway-600x471.png 600w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/a><\/p>\n<p>The console window will the GCP API calls and associated logs for the IoT Cloud Tester tool.<\/p>\n<p><a href=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-183099\" src=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway.png\" alt=\"\" width=\"833\" height=\"648\" srcset=\"https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway.png 833w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway-300x233.png 300w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway-768x597.png 768w, https:\/\/m2msupport.net\/m2msupport\/wp-content\/uploads\/2021\/05\/device_gateway_publish_console_no_gateway-600x467.png 600w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/a><\/p>\n<p>To connect to Google MQTT server,<\/p>\n<ul>\n<li>MQTT Client Id should be set to the below format &#8211; projects\/projId\/locations\/cloudRegion\/registries\/regId\/devices\/deviceId<\/li>\n<li>&nbsp;JSON Web Token (JWT) is generated using device&#8217;s private key and set as password for the MQTT connection. The user name for the MQTT connection is not used.<\/li>\n<\/ul>\n<div class=\"video-responsive\"><iframe loading=\"lazy\" id=\"youTubePlayer\" src=\"https:\/\/www.youtube.com\/embed\/MjlznyeUyOs?hd=1\" width=\"750\" height=\"421\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Devices send data to Google Cloud Platform by publishing to the&nbsp;Message Queue Telemetry Transport (MQTT) bridge in the Google Cloud Platform. IoT Cloud Tester&nbsp; application provides an easy interface publish data to the Google Cloud Platform (GCP). To publish without &hellip; <a href=\"https:\/\/m2msupport.net\/m2msupport\/publish-without-gateway-through-mqtt-bridge-in-google-cloud-platform-gcp\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"iot_tutorial_template.php","meta":{"footnotes":""},"class_list":["post-183095","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/183095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/comments?post=183095"}],"version-history":[{"count":2,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/183095\/revisions"}],"predecessor-version":[{"id":183101,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/183095\/revisions\/183101"}],"wp:attachment":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/media?parent=183095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}