Constant-Temperature Air Conditioner
Scenarios
Using a constant-temperature control system, you can adjust the default temperature of air conditioners (regardless of whether they are powered on). After being powered on, the air conditioners automatically run at the default temperature. This is achieved by using the device shadow of the IoT platform. For any connected air conditioner, you can set the device shadow on the application or IoTDA console to deliver the preset temperature to the air conditioner. The air conditioner automatically adjusts the temperature after receiving the property modification request.
Developing a Product
- Log in to the IoTDA console.
- In the navigation pane, click Products. Click the drop-down list box above the product list, and select the resource space to which the new product belongs.
- Click Create Product in the upper right corner to create a constant-temperature air conditioner product, set the parameters, and click Create.
Set Basic Info
Product Name
Enter a value, for example, aircondition.
Protocol
Select MQTT.
Data Type
Select JSON.
Manufacturer
Customize the value.
Define Product Model
Product Model
Customize a product model by following 5.
Industry
Customize the values.
Device Type
- After the product is created, click View to access its details.
- On the Model Definition tab page, click Custom Model and configure the product model based on the table below.
Service data
Service
Service: temperature
Property
Property Name: temperature
Mandatory: selected
Data Type: jsonObject
Access Permissions: Read, Write, and Execute
Length: 1
- In the navigation pane, choose , and click Individual Register. In the dialog box displayed, set the parameters based on the table below and click OK.

Parameter
Description
Product
Select the product created in 3.
Node ID
Set the node ID to a string consisting of letters and numbers. The device ID (corresponding to the node ID) and secret generated after the registration are used for device access.
Device Name
Customize the name.
Authentication Type
Select Secret.
Secret
Customize the secret used for device access. If no secret is specified, the platform automatically generates a secret.
Configuring a Device Shadow
You can set a device shadow on the IoTDA console or by calling the API Configuring Desired Device Shadow Data on the application side. This section describes how to set a device shadow on the IoTDA console.
- Log in to the IoTDA console, choose Devices > All Devices in the navigation pane, and click View in the row of the device registered in 6 to access its details.
- On the Device Shadow tab page, click Configure Property.
- In the dialog box displayed, enter the desired value of a property. In this example, the value of temperature is set to 25.

Verifying the Configurations
Method 1:
You can use MQTT.fx to simulate device verification.
- Use MQTT.fx to simulate a constant-temperature air conditioner and connect it to the platform. For details, see Using MQTT.fx to Experience Device Access.
- On the Subscribe tab page, enter topic=$oc/devices/{device_id}/sys/shadow/get/response/# of the device shadow (where {device_id} must be the same as the device ID in 6), and click Subscribe.

- On the Publish tab page, enter Topic=$oc/devices/{device_id}/sys/shadow/get/request_id={request_id} of the device shadow.
- Enter a request for obtaining the device shadow and click Publish. Example:
{ "object_device_id": "40fe3542-f4cc-4b6a-98c3-61a49ba1acd4", "service_id": temperature" }
- Click the Subscribe tab. The device shadow data delivered by the platform is displayed.

Method 2:
You can connect a physical device to the platform. The device will receive the device shadow configuration delivered by the platform and change the preset temperature accordingly.
Last Article: Developing a Protocol Conversion Gateway for Access of Generic-Protocol Devices
Next Article: Data Forwarding
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.