Getting information about devices
To find out the unique ID or name of a device, get a list of devices in a registry.
Getting a list of devices in a registry
If you don't know the unique ID or name of the registry where your device is located, view the list of existing registries.
- In the management console
, select the folder where the registry is located. - Go to IoT Core.
- Select the registry.
- Navigate to the Devices tab.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
View the description of the CLI command to get a list of devices:
yc iot device list --help -
Get a list of devices in the registry by specifying its name or ID:
yc iot device list --registry-name <registry_name>Result:
+----------------------+-----------+ | ID | NAME | +----------------------+-----------+ | b9135goeh1uc******** | my-device | +----------------------+-----------+
To get a list of devices in a registry, use the list REST API method for the Device resource or the DeviceService/List gRPC API call.
Getting information about a device
To access a device, use the unique ID or name of the registry from the previous step.
- In the management console
, select the folder where the device is located. - Go to IoT Core.
- Select the registry where the device is located.
- Navigate to the Devices tab.
- Select the device.
- The Overview page will show the device details.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
View the description of the CLI command to get information about a device:
yc iot device get --help -
Get detailed information about a device by specifying its name or ID:
yc iot device get <device_name>Result:
id: b9135goeh1uc******** registry_id: b91ki3851hab******** created_at: "2019-05-28T16:08:30.938Z" name: my-device
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To get detailed information about a device using Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_iot_core_device" "my_device" { device_id = "<device_ID>" } output "device_params" { value = data.yandex_iot_core_device.my_device.registry_id }Where:
data "yandex_iot_core_device": Description of the device as a data source:device_id: Device ID.
output "device_params": Output variable containing information about the registry the device belongs to:value: Return value.
You can replace
registry_idwith any other parameter to get the information you need. For more information about theyandex_iot_core_devicedata source properties, see this Terraform provider article. -
Create the resources:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create the required resources and display their output variables. To check the results, run this command:
terraform outputResult:
device_params = "are7ajlrf493********" -
To get detailed information about a device, use the get REST API method for the Device resource or the DeviceService/Get gRPC API call.
Device monitoring data is updated when accessing the device via gRPCS and MQTT. The quality of service (QoS) level is at most once.