...
After you create a gateway, you can't change it to a non-gateway device. Ensure you've created a registry and a device key pair before completing the steps in this sectionbelow.
Console
To create a new gateway:
Go to the Google Cloud console’s Registries page in the Google Cloud console.
Click the gateway’s registry ID.
On the Registry details page, click Gateways and Add gateway to create a new gateway.
Enter a Gateway ID that briefly describes the gateway and helps you identify it (this field can't be edited later).
For Gateway communication, select Allow or Block. The latter allows you to block communication when needed, such as when a gateway or one or more devices bound to it are not functioning properly. You’ll most likely want to allow communication when first creating the gateway. When a gateway is blocked, all devices bound to it are blocked from communicating with ClearBlade IoT Core.
Select the Public key format that matches the this gateway’s key pair for this gateway. Paste the certificate or key in the Public key value field. You can also set an the key’s expiration date for the key.
Select the authentication method to use for devices bound to the gateway.
Use the Key and Value fields to add optional gateway metadata, such as a serial number.
Under Stackdriver Logging, select an the gateway’s activity log level for the gateway. The gateway's log level overrides its registry's log level.
Click Create to create the gateway or Update to save changes to an existing gateway.
...
Go to the Registries page.
Click the gateway’s registry ID.
Click Registry details.
Click Gateways.
Click the gateway’s ID you want to edit.
Click Edit at the top of the page.
To add a key to an existing gateway, click Add public key on the Device details page.
API
Use the following methods to create or edit a gateway:
...
Go to the Registries page.
Click the gateway’s registry ID.
Click Gateways, then click the gateway's ID.
On the Gateway details page, click Bound devices.
Click Bind device.
Select the devices you want to bind to the gateway, then click Bind.
To unbind a device, select the device in the Gateway details page, and click Unbind device and Unbind to confirm.
API
Use the following methods to bind a device to or unbind a device from a gateway:
...
Go to the Registries page.
Click the gateway’s registry ID.
Click Gateways, then click the gateway's ID.
On the Gateway details page, click Bound devices.
API
Use the Devices list method and specify a gateway ID to list all devices bound to the gateway.
...
Go to the Registries page.
Click the gateway’s registry ID.
On the Registry details page, click Gateways to see a list of the registry’s gateways.
...
Use the Device list method to list all a registry’s gateways in a registry.
Listing
...
a registry’s gateways
...
code samples
Node.js
Code Block |
---|
// const cloudRegion = 'us-central1'; // const projectId = 'adjective-noun-123'; // const registryId = 'my-registry'; import { DeviceManagerClient } from '@clearblade/iot'; const iotClient = new DeviceManagerClient({ // optional auth parameters. }); async function listDevices() { // Construct request const registryPath = iotClient.registryPath(projectId, cloudRegion, registryId); console.log('Current gateways in registry:'); const [response] = await iotClient.listDevices({ parent: registryPath, fieldMask: { paths: ['config', 'gateway_config'] }, gatewayListOptions: { gatewayType: 'GATEWAY' } }); const devices = response; devices.forEach((device) => { console.log('----\n', device); }); } listDevices(); |
...
Unbind the device from every gateway it's bound to.
In the Device details page, click Delete.
Enter the device ID to confirm and click Delete.
API
After unbinding the device from all gateways it's bound to, use the Device delete method to delete the device.
...
Go back to the Gateway details page and click Delete.
Enter the gateway's name to confirm, then click Delete.
API
After unbinding all devices from the gateway, use the Device delete method to delete the gateway, specifying the gateway’s ID you want to delete.
...