Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

The droids we are looking for

Subject appearance

This document describes GATT characteristics used to control Triones smart RGBW BLE bulbs (like on the picture above). Yes, they look the same as [Zengge bulbs](../ZJ-MBL-RGBW (v3)/protocol.md). My guess is that all cheap Chinese bulbs looks identically to each other, and only differ in GATT characteristics UUIDs.

All the text below is a result of my own experience of reverse-engineering its protocol. Use it at your own risk, I am not responsible for your hardware.

Communication principles

TODO

The protocol

Status

Status request is used to query some generic bulb parameters, like power status, current color or built-in mode. Status query is done in "write and listen" manner, so it will not work in non-interactive gatttool mode (you won't be able to see the result). Check the code for more details.

Request

Type Write and listen
Write to FFD9
Notification from FFD4
Payload Constant, [0xEF, 0x01, 0x77]
Notification See the description below

Notification description

Resulting notification must be 12 bytes long.

  1. result[0] must be equal to magic constant 0x66
  2. result[1]: ???
  3. result[2]: power status:
    • 0x23 is for "ON".
    • 0x24 is for "OFF".
  4. result[3]: mode:
  5. result[4]: ???
  6. result[5]: speed
  7. result[6]: red color component
  8. result[7]: green color component
  9. result[8]: blue color component
  10. result[9]: white color intensity (when the bulb is in white color mode)
  11. result[10]: ???
  12. result[11] must be equal to magic constant 0x99

Examples

Magic ??? Power Mode ??? Speed R G B W ??? Magic Description
0x66 0x15 0x23 0x41 0x20 0x00 0xFF 0x00 0x00 0x00 0x06 0x99 Static red color
0x66 0x15 0x23 0x41 0x20 0x00 0x00 0xFF 0x00 0x00 0x06 0x99 Static green color
0x66 0x15 0x23 0x41 0x20 0x00 0x00 0x00 0xFF 0x00 0x06 0x99 Static blue color
0x66 0x15 0x23 0x41 0x20 0x00 0x00 0x00 0x00 0x30 0x06 0x99 White color with low intensity
0x66 0x15 0x23 0x27 0x20 0x1F 0xFF 0x00 0x00 0x00 0x06 0x99 Built‑in mode 0x27 at speed 0x1F (the slowest possible)
0x66 0x15 0x23 0x34 0x20 0x10 0xFF 0x00 0x00 0x00 0x06 0x99 Built‑in mode 0x34 at speed 0x10 (fast)
0x66 0x15 0x24 0x34 0x20 0x10 0xFF 0x00 0x00 0x00 0x06 0x99 Bulb is turned off with built‑in mode 0x34 at speed 0x10 (fast)

Power

Set current power status

Power is turned on and off via write request to FFD9 characteristic under FFD5 servce. Check the code for more details.

Requests

Type Write
Write to FFD9
Payload See below

Payload description

Payload must be 3 bytes long.

  1. payload[0] must be equal to magic constant 0xCC
  2. payload[1]: 0x23 for "ON" and 0x24 for "OFF"
  3. payload[2] must be equal to magic constant 0x33

Example

Magic Power status Magic Description
0xCC 0x23 0x33 Turn power on
0xCC 0x24 0x33 Turn power off

Static color mode

Static color mode is set via write request to FFD9 characteristic under FFD5 servce. Check the code for more details.

Request

Type Write
Write to FFD9
Payload See below

Payload description

Payload must be 7 bytes long.

  1. payload[0] must be equal to magic constant 0x56
  2. payload[1]: red color component
  3. payload[2]: green color component
  4. payload[3]: blue color component
  5. payload[4] must be equal to magic constant 0x00
  6. payload[5] must be equal to magic constant 0xF0
  7. payload[6] must be equal to magic constant 0xAA

Examples

Magic R G B Magic Magic Magic Description
0x56 0xFF 0x00 0x00 0x00 0xF0 0xAA Static red color
0x56 0x00 0xFF 0x00 0x00 0xF0 0xAA Static green color
0x56 0x00 0x00 0xFF 0x00 0xF0 0xAA Static blue color
0x56 0x5A 0x00 0x9D 0x00 0xF0 0xAA Static violet color

White color

White color is set via write request to FFD9 characteristic under FFD5 servce. Check the code for more details.

Request

Type Write
Write to FFD9
Payload See below

Payload description

Payload must be 7 bytes long.

  1. payload[0] must be equal to magic constant 0x56
  2. payload[1]: not used
  3. payload[2]: not used
  4. payload[3]: not used
  5. payload[4]: intensity
  6. payload[5] must be equal to magic constant 0x0F
  7. payload[6] must be equal to magic constant 0xAA

Examples

Magic N/A N/A N/A Intensity Magic Magic Description
0x56 0xDE 0xAD 0xFF 0x01 0x0F 0xAA Lowest possible intensity
0x56 0xCA 0xFE 0x00 0xFF 0x0F 0xAA Highest possible intensity

Built-in mode

Built-in mode is set via write request to FFD9 characteristic. Check the code for more details.

Request

Type Write
Write to FFD9
Payload See below

Payload description

Payload must be 4 bytes long.

  1. payload[0] must be equal to magic constant 0xBB
  2. payload[1]: build-in mode
  3. payload[2]: speed
  4. payload[3] must be equal to magic constant 0x44

Examples

Magic Mode Speed Magic Description
0xBB 0x27 0x1F 0x44 Built‑in mode 0x27 at speed 0x1F (the slowest possible)
0xBB 0x34 0x10 0x44 Built‑in mode 0x34 at speed 0x10 (fast)

Clock

Query for current clock value

Unfortunately, I do not know the way to query for current bulb's clock value.

Set clock value

Current clock can be set by writing FFD9 characteristic. Check the code for more details.

Request

Type Write
Write to FFD9
Payload See below

Payload description

Payload must be 11 bytes long.

  1. payload[0] must be equal to magic constant 0x10
  2. payload[1] year divided by 100
  3. payload[2] remainder of dividing year by 100
  4. payload[3] month (1 is Jan., 2 is Feb., etc)
  5. payload[4] day of month, starting from 1
  6. payload[5] hours (24 hours format)
  7. payload[6] minutes
  8. payload[7] seconds
  9. payload[8] day of week (SUN is 0)
  10. payload[9] must be equal to magic constant 0x00
  11. payload[10] must be equal to magic constant 0x01

Example

Magic Upper year Lower year Month Date Hours Minutes Seconds Day of week Magic Magic Description
0x10 0x14 0x10 0x02 0x1C 0x05 0x07 0x18 0x07 0x00 0x01 Sun Feb 28 05:07:24 2016

Timings

TODO

Magic constants

Built-in modes

  1. 0x25: Seven color cross fade
  2. 0x26: Red gradual change
  3. 0x27: Green gradual change
  4. 0x28: Blue gradual change
  5. 0x29: Yellow gradual change
  6. 0x2A: Cyan gradual change
  7. 0x2B: Purple gradual change
  8. 0x2C: White gradual change
  9. 0x2D: Red, Green cross fade
  10. 0x2E: Red blue cross fade
  11. 0x2F: Green blue cross fade
  12. 0x30: Seven color stobe flash
  13. 0x31: Red strobe flash
  14. 0x32: Green strobe flash
  15. 0x33: Blue strobe flash
  16. 0x34: Yellow strobe flash
  17. 0x35: Cyan strobe flash
  18. 0x36: Purple strobe flash
  19. 0x37: White strobe flash
  20. 0x38: Seven color jumping change

Speed

Some operational modes take a speed parameter that controls how fast the colors are changed. 0x01 is the fastest, 0xFF is the slowest.