TuyaOSNetworked Product FrameworkCapability MapActivate Devices in AP Without Internet

Activate Devices in AP Without Internet

Last Updated on : 2023-12-19 08:36:57download

Without a direct connection to the internet, a Wi-Fi device can be activated with the mobile app acting as a proxy. After the mobile app completes the activation in the cloud, it connects to the access point (AP) of the target device and activates it.

Feature description

  • Activate a device without internet: This is mostly used for IP cameras (IPC).

    1. The user scans the QR code on the device using the mobile app.
    2. The mobile app gets the device information and acts as a proxy to activate the device in the cloud.
    3. The mobile app connects to the AP from the target device to create a LAN.
    4. The mobile app sends the data point (DP) description received from the cloud to the target device for activation.
    5. Then, the mobile app can control and communicate with the device over the LAN.
  • Perform OTA updates without internet:

    1. The mobile app downloads the update and then connects to the AP of the device.
    2. The mobile app sends updates to the activated device via a proxy, allowing it to install updates without internet access.

Process

Activate devices in AP without internet

AppCloudDeviceScan QR code to get device information.Act as a proxy to activate the device.Return device DP description.Broadcast an access point named SmartLife-xxxx (xxxx is the last four digits of the device UUID).Instruct the user to connect to the device's access point.Connect to the device's access point.The device's access point is connected.Establish LAN communication.LAN communication is established.Send device DP description.Data is received.The device is in the activated and bound state.The user controls the device using the app.Send a control command.Execute the command.Return the current status.AppCloudDevice

Perform OTA updates without internet

AppCloudDeviceThe user opens the panel.Get device information.Return device information.Request the latest firmware update.Return the firmware update.Instruct the user to connect to the device's access point.Connect to the device's access point.The device's access point is connected.Query firmware version.Return device information.If the firmware version returned by the device does not match the one returned by the cloud, prompt the user to install the update.Display the update available dialog box.The user selects a preferred update method.Send the firmware update.Return the result of reception.Install the firmware update.The user opens the panel and is instructed to connect to the device's access point.Connect to the device's access point.The device's access point is connected.Query firmware version.Return device information.If the firmware version returned by the device matches the one returned by the cloud, the update is successful.AppCloudDevice

Development guide

Reference the header

  • tuya_iot_wifi_api.h

How to

Devices that can be activated without internet must have an AP name in the format of SmartLife-xxxx. xxxx is the last four digits of the device’s UUID. Make sure you set the AP correctly.

Activation without internet does not apply to all product categories. Check if the mobile app and panel support the use of this feature for your product.

API description

Set the AP name

Call this API to set the AP name of your product.

/**
 * @brief tuya_iot_set_user_def_ap_if
 *
 * @param[in] ssid: user defined ssid of device ap
 * @param[in] passwd: user defined ssid of device ap
 *
 * @return OPERATE_RET
 *
 * @note need call before tuya_iot_wf_xxx_init
 */
OPERATE_RET tuya_iot_set_user_def_ap_if(IN CONST CHAR_T *ssid, IN CONST CHAR_T *passwd);

Example

VOID __ty_set_user_ap_if()
{
    CHAR_T apSsid[WIFI_SSID_LEN + 1] = {0};
    CHAR_T suffix[6] = {0};
    snprintf(suffix, 4, "%s", get_gw_uuid() + strlen(get_gw_uuid())-4);
    snprintf(apSsid, SIZEOF(apSsid), "SmartLife-%s", suffix);
    if (OPRT_OK != tuya_iot_set_user_def_ap_if(apSsid, NULL)) {
        PR_ERR("set user ap if err");
    }
}

FAQs

Which TuyaOS release supports activation in AP mode without internet?

This feature is available on TuyaOS v3.6.0 and later.

What is required to use activation in AP mode without internet?

  • Set the AP name in the required format. For more information, see How to.
  • Check if the mobile app and panel support the use of this feature for your product.