Bluetooth Service

Last Updated on : 2024-05-11 08:45:46download

The standard Wi-Fi and Bluetooth combo protocol supports the following Bluetooth features:

  • When the Wi-Fi and Bluetooth combo module fails to connect to the cloud and LAN, it will turn on Bluetooth.
  • The Wi-Fi and Bluetooth combo module can pair with a Bluetooth or beacon remote.

The commands used in the Bluetooth service.

Command Description
0x35 (subcommand: 0x04) Report Bluetooth connection status
0x35 (subcommand: 0x05) Request Bluetooth connection status
0x35 (subcommand: 0x06) Sync Bluetooth or beacon remote data
0x35 (subcommand: 0x07) Bind and unbind Bluetooth or beacon remote
0x35 (subcommand: 0x08) Sync Bluetooth sub-device data
0xF2 (subcommand: 0x00) Sync Bluetooth or beacon remote DP data
0x35 (subcommand: 0x01) Test Bluetooth functionality (scanning)

Bluetooth connection status

Report Bluetooth connection status (0x35 & 0x04)

Bluetooth connection status Description Status value
Status 1 Unbound and not connected 0x00
Status 2 Unbound and connected 0x01
Status 3 Bound and not connected 0x02
Status 4 Bound and connected 0x03
Status 5 Unknown status 0x04
  • The module enters status 1 and status 2 during Bluetooth pairing.

  • The LED activity in the module self-processing mode.

    • 1: Blink quickly.
    • 2 or 3: Steady off.
    • 4: Steady on.
    • 5: Blink slowly.

When the module detects that the MCU is restarted or reconnected, it will proactively send the current Bluetooth connection status to the MCU.

  • When the Bluetooth connection status changes, the module will proactively send the current status to the MCU.
  • If you choose the module self-processing mode, implementing this protocol for your MCU is not necessary.
  • To enable reporting Bluetooth connection status, the MCU should enable bit 0 in abv field when it sends 0x3700 command to the module after power on.
  • The Bluetooth connection when power on defaults to unknown status.

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x35
Data length 2 0x0002
Data Subcommand 0x04
1 Indicate the Bluetooth status.
  • 0x00: Status 1
  • 0x01: Status 2
  • 0x02: Status 3
  • 0x03: Status 4
  • 0x04: Status 5
  • 0x05: Status 6
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 00 35 00 02 04 03 3d

The MCU returns the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x35
Data length 2 0x0001
Data Subcommand 0x04
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 00 35 00 01 04 39

Request Bluetooth connection status (0x35 and 0x05)

Bluetooth connection status Description Status value
Status 1 Unbound and not connected 0x00
Status 2 Unbound and connected 0x01
Status 3 Bound and not connected 0x02
Status 4 Bound and connected 0x03
Status 5 Unknown status 0x04

The status definition must be consistent with that defined in Report Bluetooth connection status.

The MCU sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x35
Data length 2 0x0001
Data Data 05
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 03 35 00 01 05 3D

The module returns the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x35
Data length 2 0x0002
Data Subcommand 0x05
Data Indicate the Bluetooth status.
  • 0x00: Status 1
  • 0x01: Status 2
  • 0x02: Status 3
  • 0x03: Status 4
  • 0x04: Status 5
  • 0x05: Status 6
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 03 35 00 02 05 00 3E

Bluetooth or beacon remote

Sync data (0x35 and 0x06)

  • The Bluetooth remote service must be enabled to use this feature.
  • The module enters pairing mode after the 0x02 command interaction. The pairing mode is only active for 30 seconds.
  • Up to five remotes can be paired. Otherwise, pairing will fail.

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x35
Data length 2 0x0007
Data 1 Subcommand: 0x06
N
  • Data[0]: The category ID (1 byte).
  • Data[1]: The control command (1 byte).
  • Data[2] to Data[5]: The command data (4 bytes). See the Control commands for details.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 03 35 00 02 05 00 3E

The MCU returns the following data.

Field Length Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x35
Data length 2 0x0001
Data 1 0x06 (subcommand)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: 55 aa 03 35 00 02 05 00 3E

Control commands

Command
(1 byte)
Generic command
(1 byte)
Command data (4 bytes)
Padded with 0 if needed
Category ID

Generic: 0xFF



Individual category

Lighting product: 0x01

Socket/power strip: 0x02

Curtain switch: 0x03

Drying rack: 0x04

Fan: 0x05

Bathroom heater: 0x06

Air conditioner: 0x07

Garage door opener: 0x08

Water valve: 0x09

Disinfector: 0x0A

Thermostat plug: 0x0B

Dimmer switch: 0x0C

Scene socket: 0x0D

Switch: 0x0E

Smart curtain switch module: 0x0F

Send key values: 0x01

Byte 1: Button behavior (0 – Single press. 1 – Double press. 2 – Long press. 3 – Press and hold. 4 – Press and release)

Byte 2: The key value.

Switch: 0x04

Byte 1: 0 – Turn off. 1 – Turn on. 2 – Pause.

Byte 2: The number of gangs. 0 represents the main control.

Add favorites: 0x05

Byte 1: 1 – Favorite a state. 2 – Go to a specified favorite.

Byte 2: The ID of a favorite, ranging from 0 to 3.

Countdown timer: 0x06

Bytes 1 to 2: The countdown time, in seconds and big-endian format. 0 indicates canceling the countdown timer.

Byte 3: The action to run when the countdown timer is done. (Reserved byte)

One-click group query: 0x07

The sub-device advertises the information about the added group.

Light on/off: 0x08

Byte 1: 0 – Turn off. 1 – Turn on.

Byte 2: 0 – The main switch. 1 – White light switch. 2 – Colored light switch.

Brightness adjustment: 0x09

Byte 1: 0 – Brightness value. 1 – Brightness up. 2 – Brightness down.

Byte 2: 0 – Brightness of the current mode. 1 – Brightness of white light.

Byte 3: When Byte 1 is 0, this byte indicates brightness percentage (1 to 100%). When Byte 1 is 1 or 2, this byte indicates the step value of brightness (1 to 100%).

Stepless brightness adjustment: 0x0A

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: 0 – Brightness of the current mode. 1 – Brightness of white light.

Byte 3: Rate (adjustment percentage per second)

Byte 4: The target value.

Color temperature adjustment: 0x0B

Byte 1: 0 – Color temperature value. 1 – Color temperature up. 2 – Color temperature down.

Byte 2: When Byte 1 is 0, this byte indicates color temperature percentage (0 to 100%). When Byte 1 is 1 or 2, this byte indicates the step value of color temperature (0 to 100%).

Stepless color temperature adjustment: 0x0C

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value.

Color adjustment: 0x0D

Byte 1: 0 – Relative transition. 1 – The specified color. 2 – Start cycling adjustment. 3 – Stop cycling adjustment.

Byte 2: The ID of the specified color when Byte 1 is 1.

Hue adjustment: 0x0E

Byte 1: 0 – Hue value. 1 – Hue up. 2 – Hue down.

Byte 2: When Byte 1 is 0, this byte indicates hue percentage (0 to 100%). When Byte 1 is 1 or 2, this byte indicates the step value of hue (0 to 100%).

Stepless hue adjustment: 0x0F

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value.

Saturation adjustment: 0x10

Byte 1: 0 – Saturation value. 1 – Saturation up. 2 – Saturation down.

Byte 2: When Byte 1 is 0, this byte indicates saturation percentage (0 to 100%). When Byte 1 is 1 or 2, this byte indicates the step value of saturation (0 to 100%).

Stepless saturation adjustment: 0x11

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value.

Value adjustment: 0x12

Byte 1: 0 – Value. 1 – Value up. 2 – Value down.

Byte 2: When Byte 1 is 0, this byte indicates value percentage (1 to 100%). When Byte 1 is 1 or 2, this byte indicates the step value of value (1 to 100%).

Stepless value adjustment: 0x13

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value.

HSV (hue, saturation, value) adjustment: 0x14

Byte 1: Hue percentage (0 to 100%)

Byte 2: Saturation (0 to 100%)

Byte 3: Value percentage (1 to 100%)

Scene adjustment: 0x15

Byte 1: 0 – Relative transition. 1 – The specified scene. 2 – Start cycling adjustment. 3 – Stop cycling adjustment.

Byte 2: The ID of the specified scene when Byte 1 is 1.

Lighting mode selection: 0x16

Byte 1: 1 – Night light mode.

Motor rotation adjustment: 0x20

Byte 1: 0 – Clockwise rotation. 1 – Counterclockwise rotation. 2 – Pause.

Byte 2: Travel percentage (0 to 100%). 0 – Continuous rotation.

Byte 3: The number of channels. 0 represents the total channel.

Motor travel setting: 0x21

Byte 1: 0 – The start position. 1 – The fine-tuning position. 2 – The end position.

Byte 2: 0 – The up limit. 1 – The down limit. 2 – The intermediate limit.

Byte 3: The number of channels. 0 represents the total channel.

Movement speed adjustment: 0x22

Byte 1: 0 – Speed. 1 – Step increment. 2 – Step decrement.

Byte 2: The specified speed or step value of speed. Byte 3: The number of channels. 0 represents the total channel.

Stepless movement speed adjustment: 0x23

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value. <br>Byte 4: The number of channels. 0 represents the total channel.

Temperature adjustment: 0x24

Byte 1: 0 – The temperature value. 1 – Temperature up. 2 – Temperature down.

Bytes 2 to 3: When Byte 1 is 0, this byte indicates the specified temperature. When Byte 1 is 1 or 2, this byte indicates the step value of temperature. The 2-byte temperature value is stored in big-endian. The most significant bit represents the sign (minus or plus) and the rest of the bits represent the number. The number multiplied by 0.1°C is the actual temperature.

Stepless temperature adjustment: 0x25

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Bytes 3 to 4: The target value of temperature, which is calculated the same as above.

Humidity adjustment: 0x26

Byte 1: 0 – Humidity value. 1 – Humidity up. 2 – Humidity down.

Byte 2: The specified humidity.

Stepless humidity adjustment: 0x27

Byte 1: 0 – Start incrementing. 1 – Start decrementing. 2 – Stop adjustment.

Byte 2: Rate (adjustment percentage per second)

Byte 3: The target value.

Custom command

Custom category (1 byte)

Custom command (1 byte)

Parameter (3 bytes)

Lights: 0xFF

RGBY (red, green, blue, yellow) adjustment:0x01

Byte 1: 0 – Change color to red. 1 – Change color to green. 2 – Change color to blue. 3 – Change color to yellow.

Fan: 0xFE

Fan mode: 0x01

Byte 1: 0 – Manual adjustment. 1 – Natural wind. 2: Sleep wind.

Bathroom heater: 0xFD

Bathroom heater mode: 0x01

Byte 1: 0 – Heating. 1 – Ventilation. 2 – Drying. 3 – Fan.

Air conditioner: 0xFC

Sleep: 0x01

Byte 1: 0 – Off. 1 – On.

Bind and unbind (0x35 and 0x07)

The Bluetooth remote service must be enabled to use this feature.

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x35
Data length 2 0x0003
Data 1 Subcommand: 0x07
Data 1
  • 0x00: Unbind
  • 0x01: Bind
Data 1 The group ID.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The MCU returns the following data.

Field Length Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x35
Data length 2 0x0001
Data 1 0x07 (subcommand)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Sync DP data (0xF2 and 0x00)

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0xF2
Data length 2 0x0007 + N
Data 1 Subcommand: 0x00
6 The MAC addresses.
N The DP data.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The MCU returns the following data.

Field Length Description
Header 2 0x55aa
Version 1 0x03
Command 1 0xF2
Data length 2 0x0001
Data 1 0x00 (subcommand)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

DP data format

Field Length Description
DP ID 1 -
DP type + DP length 1 The upper 4 bits represent the DP type, while the lower 4 bits indicate the DP length.
DP data N -

For more information about the DP type, see DP format.

Bluetooth sub-device

Sync data (0x35 and 0x08)

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x35
Data length 2 0x0001 + N
Data 1 Subcommand: 0x08
Data N Bluetooth sub-device data:
  • mac: Six bytes.
  • seq: Four bytes.
  • data: The data.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Bluetooth functionality testing

For more information, see Test Bluetooth scanning.