UDP
This guide will show you how to integrate UDP protocol devices into Aqara Studio by writing JS scripts, and how to map device function points according to the Aqara Data Model Specification, enabling device discovery, addition, and control of function points.
Tested UDP Devices
The following UDP device has been tested by Aqara and can be integrated with Aqara Studio:
- Mantunsci smart circuit breakers that meet the following version requirements:
- Firmware version 3.2.63 or higher
- Web version 1.1.08 or higher
If you would like Aqara to test more products, please send the brand, model, product information, and your contact details to eco-partnerships@aqara.com so that Aqara can follow up with you.
Learn and Write JavaScript Scripts
For the shared script structure and configuration workflow, see the third-party device script integration guide.
Please refer to the JavaScript script (for UDP and TCP) guide to write a JavaScript script that complies with the Aqara Data Model Specification. This script instructs Aqara Studio how to discover devices, and add and control function points.
Install the Plugin
Please refer to the Plugin Market instruction, and go to Aqara Builder Lab - Marketplace to install the UDP Protocol Access plugin.
Add UDP Devices
-
In the left sidebar, click to enter the Devices page. In the left Protocols and Devices panel, click the ... button and select Add Protocol.
-
In the popup, select
UDPto add a UDP node.
-
Select the node to enter the management page. Click the Protocol Configuration button.
-
In the popup, click the Script Configuration button.
-
Paste the JavaScript script you wrote into the code editor, ensuring that the UDP device and its function points can be correctly recognized and managed by Aqara Studio.
-
(Optional) If you want to use
msgIdto match sent messages with received messages, enable theMatch by msgIdswitch. If it is not enabled, messages are processed in order.
-
Return to the UDP management page and click the Add Device button.
-
In the popup, select Auto Discovery as the integration method, then select Start Integrating Device to proceed to the next step.
-
(Optional) Click the ⚙ icon.
tipdescribe().discovery may specify a target or omit UDP IP for local broadcast calculation. Decode real replies into devices; use published manual creation if no discovery protocol exists. A static address list is not completed discovery.
Enter the vendor unicast/broadcast/multicast destination and port or use script discovery settings. encode(discoverDevices) builds requests; decode parses identity/communication addresses from responses.
-
Click the Discover Devices button.
Aqara Studio will automatically scan and identify UDP devices that can be integrated based on the JS script you wrote, and the discovered devices will be displayed in the Discovered Devices list.
-
Select the devices to integrate and click the + button in the center.
Newly added devices will appear in the Added Device List on the right. Click the Complete button to exit the add device process.
-
You will then see the successfully added devices under the UDP node in the left Protocols and Devices panel, as well as in the device list on the UDP management page.
Add Points
-
Under the UDP node, select a UDP device and click the Add Point button.
-
Click the Discover Points button.
tip- Remote point lists: encode(discoverPoints) sends bytes; decode returns pointDefinitions from the actual response.
- Static point lists: encode(discoverPoints) returns null; decode receives bytes=null and returns pointDefinitions without a request. Both require selecting/importing points. Runtime option changes use dynamic enums, not repeated point creation.
-
In the Discovered Points list, check the required points and click the middle + button.
Newly added points will appear in the Added Points list on the right. Click the Complete button to exit the add points process.
-
You will then see the successfully added points on the management page of that UDP device.
Next Steps
Now, you can view details and control the device, or use the device in automation.