Device Binding over LAN

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

The mobile app sends the token to the device on the same LAN. The device then completes the binding and activation process after receiving the token. This solution applies to devices that can complete the pairing process independently, such as wired devices and those with a screen for entering Wi-Fi network credentials.

How it works

DeviceRouterAppInitiate a connection request.Connected.Initiate a connection request.Connected.The router, device, and app create a LAN.Listen for advertising packets.Send advertising frames.Forward advertising frames.Initiate a connection request.Connected.Send the token.Received.Complete the activation process.DeviceRouterApp

Development guide

Runtime environment

Open tuya_iot_config.h and check if the following macro is defined.

#define ENABLE_TUYA_LAN 1

How to

  • For a wired device, you can directly call the wired device initialization API.

  • For a wireless device, after the wireless device initialization API is called, the application proactively calls the Wi-Fi network connection API.

    When the development framework detects that the device is connected to the router, it enables binding over a LAN and sends advertising packets over the LAN.

FAQs

What are the requirements for the LAN protocol?

LAN protocol versions 3.3, 3.4, and 3.5 are supported. The cryptographic keys vary by LAN protocol versions. The LAN protocol of the development framework must match the one used on the mobile app. Otherwise, data parsing will fail.