Bluetooth Low Energy Mesh Protocol Specification

Last Updated on : 2024-06-26 07:05:45download

This topic describes how to configure standard fields for Bluetooth Low Energy (LE) mesh networking to implement Bluetooth LE mesh device discovering and provisioning. After you complete the configuration, a provisioner, typically the app or gateway, can then provision a Bluetooth LE mesh device.

The app in this topic can be the Smart Life app, OEM app, and the app you developed with app SDK.

Configure UUID

Bluetooth mesh specification specifies:

  • An unprovisioned device must support PB-ADV and may support PB-GATT.
  • A provisioner must support both PB-ADV and PB-GATT or at least one of them.

Tuya Bluetooth LE mesh protocol specifies that a Bluetooth LE mesh device must support PB-ADV and PB-GATT, a mobile phone can provision a device through PB-GATT, and a gateway can provision a device through PB-ADV or PB-GATT.

Unprovisioned device beacon

  • The unprovisioned device beacon is used by devices that are unprovisioned to allow them to be discovered by a provisioner. A provisioner can scan for nearby devices that are advertising and then get their product ID (PID). The format of this beacon is defined in the following figure.

    Bluetooth Low Energy Mesh Protocol Specification

  • For the provisioner that does not support PB-ADV, such as the mobile phone, it provisions a device through PB-GATT. The format of advertising data is defined in the following figure.

    Bluetooth Low Energy Mesh Protocol Specification

Device UUID

The device UUID is composed of the device’s MAC address, mesh category, and PID.

UUID fields:

Types Byte(s) Description
MAC 6 The MAC address of a Bluetooth LE mesh device.
Mesh category 2 The capabilities of a Bluetooth LE mesh device.
Product ID (PID) 8 The product ID generated on the Tuya Developer Platform.

For example, if a device’s MAC address is 0x112233445566, mesh category is 0x1011, and PID is abcdefgh, this device’s UUID in hexadecimal notation is 11 22 33 44 55 66 10 11 61 62 63 64 65 66 67 68.

Mesh category

  Octet 1 Octet 0
Types RFU Device types RFU Product category Product type
Bit Bit 15 to bit 14 Bit 13 to bit 12 Bit 11 to bit 8 Bit 7 to bit 4 Bit 3 to bit 0
Description Reserved by Tuya
  • 1 indicates the standard type.
  • 0 indicates the pass-through type.
Reserved by Tuya The product category includes lights, electrical products, and sensors. For more information, see the following table of the product category. The product type classifies one product category in terms of specification.

Product category description:

Product type Product category
Lights 0x01
Electrical products 0x02
Sensors 0x04
Remote controls 0x05
Wireless switches 0x06
Mains-powered sensors 0x07
Mains-powered remote controls 0x08

The specific mesh category for each product category will be described in its integration protocol. If the UUID does not conform to Tuya’s UUID format, it might not be registered and activated on the Tuya Developer Platform.

Device information

Fields of Composition Data Page 0 in Bluetooth mesh specification can be used to store device information.

Firmware version

Use VID (VERSION_ID) in Composition Data Page 0 to represent the firmware version that is displayed in ASCII format. For example, if VERSION_ID is 0x3533, it represents version 3.5.

Product information

Use PID (PRODUCT_ID) in Composition Data Page 0 to represent product ID.

  • PRODUCT_ID Octet 0:

    Octet 0 RFU
    Bit width 8 bits
    Description Reserved by Tuya
  • PRODUCT_ID Octet 1:

    Octet 1 RFU Key sharing Device types
    Bit width 6 bits 1 bit 1 bit
    Description Reserved by Tuya Whether to support app_key sharing and sub sharing between models. Device registration method

    Two device registration methods are available. 0 indicates registration through PID and 1 indicates registration through the product key. Only the Smart Life app support registration through the product key. For the logic of sharing model key and subscription address between models, you need to implement it in the firmware.