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
Help Center/ IoT Device Access/ Getting Started/ Quick Device Access - Property Reporting and Command Receiving/ Using MQTT.fx to Simulate Communication Between the Smart Street Light and the Platform

Using MQTT.fx to Simulate Communication Between the Smart Street Light and the Platform

Updated on 2025-03-03 GMT+08:00

Connecting the Simulated Street Light to the Platform

Use MQTT.fx to activate the device registered on IoTDA.

  1. Download MQTT.fx (64-bit OS) or MQTT.fx (32-bit OS) and install it.
  2. Go to the device details page, find MQTT Connection Parameter, and click View to check the clientId, username, password, and hostname.

    Figure 1 Device - Device details
    Figure 2 Device - Device details - MQTT connection parameters

  3. Open MQTT.fx and click the setting icon.

    Figure 3 MQTT.fx Settings

  4. Click the User Credentials tab and set authentication parameters by referring to the following table.

    Figure 4 Configuring authentication parameters
    Table 1 Parameter description

    Parameter

    Description

    Broker Address

    Host name, which is obtained in 2. The access address is a domain name. For devices that cannot be connected to the platform using a domain name, run the ping Domain name command in the CLI to obtain the IP address. The IP address is variable and needs to be set using a configuration item.

    Broker Port

    8883. In this example, port 8883 is used for secure connection.

    Client ID

    Enter the device client ID obtained in 2.

    User Name

    Enter the device ID obtained in 2.

    Password

    Enter the encrypted device secret obtained in 2.

  5. Click the SSL/TLS tab and then select Enable SSL/TLS. Recommended: Set Protocol to TLSv1.2. Click CA certificate file, go to the certificate resources page to download the certificate file of the corresponding region and instance version, and enter the complete local path of the certificate file in the text box. Click Apply, and then click Cancel to exit the configuration page.

    Figure 5 Setting SSL/TLS parameters

  6. Click Connect. If the icon in the upper right corner turns green, the device simulator has been authenticated and connected. The device status displayed on the platform is Online.

    Figure 6 Device simulator connected
    Figure 7 Device online status

Reporting Light Intensity Data

Use MQTT.fx to report light intensity data to the IoT platform. If a device reports data through the MQTT channel, the data needs to be sent to a specific topic in the format $oc/devices/{device_id}/sys/properties/report. For devices that each has a different secret, set device_id to the device ID returned upon successful device registration.

  1. Enter the API URL, for example, $oc/devices/{device_id}/sys/properties/report.

    Figure 8 Enter a topic name.

  2. Enter the data to report in the blank area in the middle of the tool and click Publish.

    Table 2 Service data list

    Field

    Mandatory/Optional

    Type

    Description

    services

    Mandatory

    List<ServiceProperty>

    Service data list. (For details, see the ServiceProperty structure below.)

    Table 3 ServiceProperty structure

    Field

    Mandatory/Optional

    Type

    Description

    service_id

    Mandatory

    String

    Service ID.

    properties

    Mandatory

    Object

    Service properties, which are defined in the product model associated with the device.

    eventTime

    Optional

    String

    UTC time when the device reports data. The format is yyyyMMddTHHmmssZ, for example, 20161219T114920Z.

    If this parameter is not carried in the reported data or is in incorrect format, the time when IoTDA receives the data is used.

    Request example:

    {
        "services": [{
                "service_id": "BasicData",
                "properties": {
                    "luminance": 30
            }
          }
       ]
    }

  3. Check whether the device successfully reports data on the device details page. As shown in the following figure, the luminance is updated to 30.

    Figure 9 Viewing reported data - MQTT

Remotely Delivering Commands for Turning On the Light

Deliver a command on the console to remotely control smart street lights.

  1. In the navigation pane, choose Devices > All Devices, locate the target device, and click View to access its details page.
  2. Click the Cloud Delivery tab, click Deliver Command, set Command to LightControl: Switch, and set Value to ON to deliver a command for turning on the light.

    Figure 10 Command delivery - Synchronous command delivery
    Figure 11 Command delivery - LightControl
    NOTE:

    MQTT devices support only synchronous command delivery. NB-IoT devices support only asynchronous command delivery.

  3. In the MQTT.fx simulator, click the Subscribe tab and enter the command delivery topic. After the subscription, check the delivered command parameters. The format of the command delivery topic is $oc/devices/{device_id}/sys/commands/#. As shown in the following figure, the MQTT.fx simulator has received the command whose command_name is Switch and value is ON.

    Figure 12 Checking the delivered command parameters
    NOTE:

    The device needs to respond to the delivered synchronous command in a timely manner. However, MQTT.fx does not automatically report the command response. Therefore, the console page may display a message indicating that the command request times out. For details about the command response, see Platform Delivering a Command.

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