Update device registry in Google Cloud Platform (GCP) using IoT Cloud Tester
Device registries in the Google Cloud can be updated using the IoT Cloud Tester application.
To update a device registry in Google Cloud project,
- Get the list of device registries in the 'Device Registries' tab.
- Select a registry and press 'Edit Registry'
- Following fields can be updated in the device registry,
- 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)
In the below example, the protocol, Logging and Additional topic fields are updated for the device registry.
To update a device registry request in GCP, a post request is made to the below URL with the update mask
Request sent to GCP to updatedevice registry.
POST:https://cloudiot.googleapis.com/v1/projects/iot-cloud-tutorial/locations/asia-east1/registries/reg_193129?updateMask=event_notification_configs,log_level,http_config.http_enabled_state,state_notification_config.pubsub_topic_name,mqtt_config.mqtt_enabled_state
{
"eventNotificationConfigs" : [ {
"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/temperature"
} ],
"httpConfig" : {
"httpEnabledState" : "HTTP_DISABLED"
},
"logLevel" : "ERROR",
"mqttConfig" : {
"mqttEnabledState" : "MQTT_ENABLED"
}
}
{
"eventNotificationConfigs" : [ {
"pubsubTopicName" : "projects/iot-cloud-tutorial/topics/temperature"
} ],
"httpConfig" : {
"httpEnabledState" : "HTTP_DISABLED"
},
"id" : "reg_193129",
"logLevel" : "ERROR",
"mqttConfig" : {
"mqttEnabledState" : "MQTT_ENABLED"
},
"name" : "projects/iot-cloud-tutorial/locations/asia-east1/registries/reg_193129",
"stateNotificationConfig" : { }
}
The updated registry can be viewed in the Google Cloud console.
Before the device registry update,
After the device registry update,