このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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/ Best Practices/ Device Linkage/ Automatically Opening the Window upon High Gas Concentration

Automatically Opening the Window upon High Gas Concentration

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

Introduction

IoTDA can instruct a wireless window opener to open the window through a device linkage rule.

Example Scenario

In this example, a gas detector reports the gas concentration value to the IoT platform. When the gas concentration exceeds a specific threshold, the preset device linkage rule is triggered. The platform delivers a window opening command to the wireless window opener, which then opens the window as instructed.

The procedure is as follows:

1. Create a gas monitoring product.

2. Register the device based on the gas monitoring product.

3. Configure a device linkage rule.

4. Verify configurations.

Figure 1 Example

Creating a Gas Monitoring Product

  1. Visit the IoTDA product page and click Access Console. Click the target instance card.
  2. In the navigation pane, choose Products.
  3. Click Create Product on the left to create a gas monitoring product, set the parameters, and click OK.

    Table 1 Parameters for creating a product

    Basic Information

    Product Name

    Enter a value, for example, gasdevice.

    Protocol

    Select MQTT.

    Data Type

    Select JSON.

    Industry

    Customize the values.

    Device Type

  4. On the Basic Information tab page, click Customize Model and configure the product model based on the table below. The gaslevel service monitors the gas concentration. The windowswitch service executes commands for opening and closing windows.

    Table 2 Parameters of the gas concentration monitoring product model

    Service ID

    Type

    Description

    gaslevel

    Properties

    Property Name: gaslevel

    Data Type: Integer

    Access Permissions: Read

    Value range: 0–100

    windowswitch

    Commands

    Command Name: switch

    Parameter Name: switch

    Data Type: enum

    Enumerated Values: on,off

Registering a Device

  1. In the navigation pane, choose Devices > All Devices. On the displayed page, click Register Device. On the displayed page, set device registration parameters. Register the gas monitoring device and record the device ID and secret.

    Figure 2 Registering a device - gasdevice
    Table 3 Parameters for registering a device

    Parameter

    Description

    Product

    Select the product created in step 3.

    Node ID

    Set this parameter to the IMEI, MAC address, or serial number of the device. If the device is not a physical one, set this parameter to a custom character string that contains letters and digits.

    Device Name

    Customize the value.

    Authentication Type

    Select Secret.

    Secret

    Customize the secret used for device access. If the secret is left blank, the platform automatically generates a secret.

  2. In the navigation pane, choose Devices > All Devices. On the displayed page, click Register Device. On the displayed page, set device registration parameters. Register a window opener device and record the device ID and secret.

    Figure 3 Registering a device - windowswitch
    Table 4 Parameters for registering a device

    Parameter

    Description

    Product

    Select the product created in 3.

    Node ID

    Set this parameter to the IMEI, MAC address, or serial number of the device. If the device is not a physical one, set this parameter to a custom character string that contains letters and digits.

    Device Name

    Customize the value.

    Authentication Type

    Select Secret.

    Secret

    Customize the secret used for device access. If the secret is left blank, the platform automatically generates a secret.

Configuring a Device Linkage Rule

  1. In the navigation pane, choose Rules > Device Linkage, and click Create Rule. (Before creating a rule, select the resource space to which the rule will belong.)
  2. Set the parameters based on the table below. The following parameter values are only examples. You can create your own rules by referring to User Guide. After setting the parameters, click Create Rule.

    Figure 4 Creating a linkage rule - GasLevel
    Table 5 Parameters for creating a linkage rule

    Parameter

    Description

    Rule Name

    Specify the name of the rule to create, for example, windowswitch.

    Activate upon creation

    Select Activate upon creation.

    Effective Period

    Select Always effective.

    Description

    Enter a description of the rule, for example, "Automatically opens the window when the gas concentration is higher than 6".

    Set Triggers

    1. Click Add Trigger.
    2. Select Device Property.
    3. Select the product added in 3, select Assign Device, and then select the device added in 1.
    4. Select gaslevel for Select service, gaslevel for Select property, > as the operation, and enter 6. Click Trigger Mode. In the dialog box displayed, set Trigger Strategy to Repetition suppression and Data Validity Period (s) to 300, and click OK.

    Set Actions

    1. Click Add Action.
    2. Select Deliver Commands, and select the device created in 2.
    3. Select windowswitch for Select service, and on_off for Select command. Click Configure Parameter. In the dialog box displayed, set switch to on, click OK.

Verifying Configurations

Method 1:

You can use MQTT.fx to simulate device verification.

  1. Use MQTT.fx to simulate a gas detector and a window opener, and connect them to the platform. For details, see Developing an MQTT-based Simulated Smart Street Light Online.
  2. Open MQTT.fx that simulates the window opener to subscribe to commands delivered by the platform.
    1. Click the Subscribe tab.
    2. Enter Topic=$oc/devices/{device_id}/sys/commands/# of the command delivered by the subscription platform. (Replace {device_id} with the device ID obtained in 2.)
    3. Click Subscribe to deliver the subscription.
      Figure 5 Creating an MQTT subscription
  3. Switch to MQTT.fx that simulates the gas detector to report properties.
    1. Click the Publish tab.
    2. Enter topic $oc/devices/{device_id}/sys/properties/report for property reporting. (Replace {device_id} with the device ID obtained in 1.)
    3. Report the property gaslevel with a value greater than 6.
      Example:
      {
          "services": [{
                  "service_id": "gaslevel",
                  "properties": {
                      "gaslevel": 45
                  }
              }
          ]
      }
    4. Click Publish to report the property value.
      Figure 6 MQTT property reporting
  4. Switch to MQTT.fx that simulates the window opener and click the Subscribe tab. The command carrying switch with the value set to on delivered by the platform is received.
    Figure 7 Viewing delivered commands

    Method 2:

    You can use a registered physical device to access the platform and enable the device to report the gaslevel greater than 6. The device receives a command carrying switch with the value set to on and automatically opens the window.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback