Add device registry in Google Cloud Platform (GCP) using IoT Cloud Tester


Devices are added to Device Registries within the project in the Google Cloud Platform (GCP).

IoT Cloud Tester  application provides an easy interface to create device registry in Google Cloud platform.

To create a device registry in Google Cloud project,

  • Select the project.
  • In the 'Device Registries' tab, select the region and press 'Add Registry'.
  • Registry ID is automatically generated but that can be changed.
  • Add default topic, device state topic and additional topics.

Following information are required to create device registry in Google Cloud,

  • Registry ID
  • Project ID
  • Region
  • Protocol used by the devices - MQTT or HTTP or both
  • Logging level - Disabled/Error/Info/Debug
  • Default topic
  • Device State topic (optional)
  • Additional topic(s) (optional)

To create a device registry request in GCP, a post request is made to the below URL with the eventNotificationConfigs set for the topics.

Request sent to GCP to create new device registry.


POST:https://cloudiot.googleapis.com/v1/projects/iot-cloud-tutorial/locations/asia-east1/registries

{

"eventNotificationConfigs" : [ {

"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/humidity",

"subfolderMatches" : "humidity"

}, {

"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/temperature"

} ],

"httpConfig" : {

"httpEnabledState" : "HTTP_ENABLED"

},

"id" : "reg_193129",

"logLevel" : "NONE",

"mqttConfig" : {

"mqttEnabledState" : "MQTT_ENABLED"

}

}

Response for GCP for device registry creation. 

{

"eventNotificationConfigs" : [ {

"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/humidity",

"subfolderMatches" : "humidity"

}, {

"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/temperature"

} ],

"httpConfig" : {

"httpEnabledState" : "HTTP_ENABLED"

},

"id" : "reg_193129",

"logLevel" : "NONE",

"mqttConfig" : {

"mqttEnabledState" : "MQTT_ENABLED"

},

"name" : "projects/iot-cloud-tutorial/locations/asia-east1/registries/reg_193129",

"stateNotificationConfig" : { }


}

The added registry can be viewed in the Google Cloud console.

https://console.cloud.google.com/iot/locations/asia-east1/registries/reg_193129/overview?project=iot-cloud-tutorial