Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Device Obtaining Device Shadow Data from the Platform

Updated on 2024-12-02 GMT+08:00

Function

This API is used by a device to obtain device shadow data from IoTDA. You can configure desired data in a device shadow through an application or the platform. When a device goes online and subscribes to this topic, the device can obtain the device shadow data from the platform and synchronize the desired device properties.

The interaction logic is described as follows:

1. The application calls the API for configuring desired properties in a device shadow or configures the device shadow data on the console.

2. The device (which has subscribed to the corresponding topic) proactively sends a request to obtain the device shadow data from the platform.

3. The platform responds to the device request and returns the device shadow data.

4. The device parses the desired properties and modifies device properties.

Topic

Upstream: $oc/devices/{device_id}/sys/shadow/get/request_id={request_id}

Downstream: $oc/devices/{device_id}/sys/shadow/get/response/request_id={request_id}

NOTE:
  • {request_id} is used to uniquely identify a request. If this parameter is carried in a message sent by a device, ensure that the parameter value is unique on the device by using an incremental number or UUID.
  • The upstream request parameters on the device side carry the unique ID, which is carried in request_id in the downstream topic to identify the unique request chain.
  • When subscribing to a downstream topic, you are advised to use the wildcard character # to replace request_id={request_id}, that is, $oc/devices/{device_id}/sys/shadow/get/response/#.

Upstream Request Parameters

Parameter

Mandatory/Optional

Type

Description

object_device_id

Optional

String

Explanation:

ID of the device that requests its device shadow.

service_id

Optional

String

Explanation:

ID of a service of the device that requests the device shadow. If this parameter is not specified, device shadow data of all services will be returned.

Downstream Response Parameters

Parameter

Mandatory/Optional

Type

Description

object_device_id

Mandatory

String

Explanation:

ID of the device that requests its device shadow.

shadow

Optional

List<ShadowData>

Explanation:

Indicates the shadow data.

ShadowData structure

Parameter

Mandatory/Optional

Type

Description

service_id

Mandatory

String

Explanation:

Service ID of the device, which is determined by the product model.

desired

Optional

PropertiesData

Explanation:

Indicates the property list in the desired section of the device shadow.

reported

Optional

PropertiesData

Explanation:

Indicates the property list in the reported section of the device shadow.

version

Optional

Integer

Explanation:

Device shadow version.

PropertiesData structure

Parameter

Mandatory/Optional

Type

Description

properties

Mandatory

Object

Explanation:

Indicates the property list of the device service. Multiple property parameters can be defined in the product model associated with the device.

event_time

Optional

String

Explanation:

Indicates the UTC time of the device property data. The format is yyyyMMdd'T'HHmmss'Z', for example, 20161219T114920Z.

Example Upstream Request

Topic: $oc/devices/{device_id}/sys/shadow/get/request_id={request_id} 
Data format:
{
	"object_device_id": "40fe3542-f4cc-4b6a-98c3-61a49ba1acd4",
	"service_id": "WaterMeter"
}

Example Downstream Response

Topic: $oc/devices/{device_id}/sys/shadow/get/response/request_id={request_id}
Data format:
{
  "object_device_id": "40fe3542-f4cc-4b6a-98c3-61a49ba1acd4",
  "shadow": [
    {
      "service_id": "WaterMeter",
      "desired": {
        "properties": {
          "temperature": "60"
        },
        "event_time": "20151212T121212Z"
      },
      "reported": {
        "properties": {
          "temperature": "60"
        },
        "event_time": "20151212T121212Z"
      },
      "version": 1
    }
  ]
}

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback