Physical Remote

Last Updated on : 2024-05-17 03:12:05download

This topic describes how to implement control of beacon mesh devices, such as lights, sockets, and switches, using a physical remote.



Concepts Description
Remote A device, usually low power, sends control commands to a device.
Controlled device A device, usually mains powered, receives control commands, for example, lights, fans, and switches.
Bind Bind a remote with a controlled device.
Unbind Unbind a remote from a controlled device.
Time window for binding During this time window, a controlled device can receive codes from a remote to bind with it. A time window is specified with a timeout and trigger event. Example:
  • A light device is open for binding for 30 seconds each time it is powered on.
  • Activate the binding mode for a wall socket using a key combination.
Reset remote Reset the remote to factory settings, removing all binding relationships.
Reset controlled device A remote sends a reset command to a controlled device for a factory reset.
Remote control A remote sends a control command to a device.
Group A remote supports up to six groups and one overall control. Users can group devices for bulk control.


Beacon remotes can control paired or unpaired Bluetooth beacon mesh devices after binding. There is no need to add the remote to the Tuya-based mobile app. Due to its weak security, this feature typically applies to lights, fans, and radio-controlled cars.

  • A beacon mesh device can be bound with three remote controls simultaneously.
  • A remote supports up to six groups and one overall control.
  • When another remote attempts to bind with a beacon mesh device that already has three remotes bound, the device will automatically unbind from the earliest remote.
  • The remote is authenticated using the sampling proxy authentication strategy.

This feature is provided as a library libtal_beacon2.lib. Initialize it after ty_beacon2_node_init. During initialization, specify the time window, which determines how long the device remains open for binding with a remote.

The remote controls the beacon mesh device through DP commands. Therefore, whether the controller is a remote or an app, the control command will be sent to app_dps_download. When the beacon mesh device is bound with or unbound from a remote, the callback ty_beacon2_event_cb will be invoked.

Data structure

No external data structure.

API description

Function void ty_beacon_remoter_init(u8 pair_window_s) -
Purpose Initialize the remote feature. -
Request parameter pair_window_s The time window for binding, in seconds.


Check the demo tuyaos_demo_beaconmesh_peripheral.

VOID_T tal_framework_init_last(VOID_T){

#if (DEVELOP_DEBUG == 0)


    if(beacon_dev.state == STATE_NOT_PAIRED){
        u8 payload[16];
        payload[0] = 0x01;
        frame_send(0x08, 0x8000, 0x02, payload, beacon_dev.beaconkey, 0);//Report heartbeat upon power on, with no forwarding.

Functional testing


  • A beacon remote compatible with the beacon mesh protocol.
  • A device that can be controlled with a beacon remote.


  1. Activate the binding time window for the controlled device. For example, a light device is open for binding for 30 seconds each time it is powered on.
  2. During the time window, press the specified button on the remote to bind with the controlled device. ty_beacon2_event_cb returns the binding result.
  3. After binding, pressing the on/off button on the remote will send a control command to app_dps_download.

Support and help

If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.