Last Updated on : 2024-06-25 04:04:17download
Set up and commission smart home devices in bulk without internet access, making project delivery easier for real estate. This topic describes how to implement the bulk commissioning feature with TuyaOS Gateway Development Kit.
With a construction SaaS, you can configure setup templates specific to each house plan in light of devices, scenes, and automation, and issue tasks to field engineers.
The engineer uses the dedicated mobile app to add devices and test scenes and automation, and hands over privileges to end users after they move in.
End users can directly try out the pre-configured scenes without going through the setup process.
The gateway should support switching between commissioning mode and normal mode. You can use command line parameters to run a gateway in the desired mode. It is recommended to enable the gateway to restart into normal mode by default and switch to commissioning mode with button press.
Bulk commissioning requires a separate PID that is associated with the PID for normal mode. Contact your account manager for details. If you do not have a separate PID for commissioning mode, use the default one ZkOA5uJGrtu4R2f8
.
Perform the following steps to add the commissioning mode to your gateway product.
Determine whether to enter commissioning mode. If so, call tuya_set_engineer_mode
.
Call tuya_get_engineer_mode
to get the current operation mode.
tuya_iot_init
is the directory for commissioning mode (defaulting to directory for normal mode + /engineer/
).tuya_iot_init
is the directory for normal mode.In both the commissioning mode and normal mode, you need to call tuya_engineer_sdk_init
to initialize the commissioning SDK. Set the value of product_key
to the PID for normal mode. There are two scenarios for using this API.
tuya_engineer_set_tuya_zigbee_enable
must be called to enable the commissioning service for Zigbee.TY_ENGR_GW_ZIG_CBS_S
to act as parameters to this API.Initialize the SDK.
tuya_engineer_gw_init
to initialize the commissioning gateway service, with the product_key
set to the PID for commissioning mode.tuya_iot_wr_wf_sdk_init
to initialize the normal gateway service, with the product_key
set to the PID for normal mode.Specify the network interface for LAN. You need to adapt to tkl_wifi_get_ip
to return the IP address of the network interface for LAN.
/**
* @brief Set the gateway to run in commissioning mode.
* @note Call this API first when the program starts to make the gateway enter commissioning mode.
*/
VOID tuya_set_engineer_mode(VOID);
/**
* @brief Determine if the gateway is in commissioning mode.
* @note Call this API to check the operation mode.
*
* @return TRUE: Commissioning mode. FALSE: Normal mode.
*/
BOOL_T tuya_get_engineer_mode(VOID);
/**
* @brief Initialize SDK.
* @note Call this API to initialize the SDK regardless of the operation mode. In commissioning mode, the commissioning logic is processed. In normal mode, the deployment data is synchronized.
*
* @param[in] product_key The PID for normal mode.
* @param[in] eng_infra_cbs Commissioning application callback.
* @param[in] eng_zig_cbs Callback for Zigbee commissioning service.
*/
OPERATE_RET tuya_engineer_sdk_init(IN CONST CHAR_T *product_key,
IN TY_ENGR_GW_INFRA_CBS_S *eng_infra_cbs,
IN TY_ENGR_GW_ZIG_CBS_S* eng_zig_cbs);
/**
* @brief Initialize the gateway commissioning service.
* @note This API applies to commissioning mode. For normal mode, call `tuya_iot_sdk_init` / `tuya_iot_wf_sdk_init` / `tuya_iot_wr_wf_sdk_init` to initialize the gateway service.
*
* @param[in] net_mode Specify the network mode.
* @param[in] product_key The PID for commissioning mode.
* @param[in] sw_ver Firmware version.
* @param[in] attr An array of module information.
* @param[in] attr_num The length of the array of module information.
*/
OPERATE_RET tuya_engineer_gw_init(IN CONST IOT_GW_NET_TYPE_T net_mode,
IN CONST CHAR_T *product_key,
IN CONST CHAR_T *sw_ver,
IN CONST GW_ATTACH_ATTR_T *attr,
IN CONST UINT_T attr_num);
/**
* @brief Enable Zigbee commissioning service.
* @note If the gateway uses Tuya's Zigbee module, call this API to enable the Zigbee commissioning service. The SDK processes the corresponding logic. This API must be called before `tuya_engineer_sdk_init`.
*/
OPERATE_RET tuya_engineer_set_tuya_zigbee_enable(VOID);
For more information, see the example apps/tuyaos_demo_engr
.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback