The droids we are looking for
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.
result[0]
must be equal to magic constant0x66
result[1]
: ???result[2]
: power status:0x23
is for "ON".0x24
is for "OFF".
result[3]
: mode:0x25
-0x38
: build-in mode0x41
: static color mode
result[4]
: ???result[5]
: speedresult[6]
: red color componentresult[7]
: green color componentresult[8]
: blue color componentresult[9]
: white color intensity (when the bulb is in white color mode)result[10]
: ???result[11]
must be equal to magic constant0x99
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.
payload[0]
must be equal to magic constant0xCC
payload[1]
:0x23
for "ON" and0x24
for "OFF"payload[2]
must be equal to magic constant0x33
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.
payload[0]
must be equal to magic constant0x56
payload[1]
: red color componentpayload[2]
: green color componentpayload[3]
: blue color componentpayload[4]
must be equal to magic constant0x00
payload[5]
must be equal to magic constant0xF0
payload[6]
must be equal to magic constant0xAA
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.
payload[0]
must be equal to magic constant0x56
payload[1]
: not usedpayload[2]
: not usedpayload[3]
: not usedpayload[4]
: intensitypayload[5]
must be equal to magic constant0x0F
payload[6]
must be equal to magic constant0xAA
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.
payload[0]
must be equal to magic constant0xBB
payload[1]
: build-in modepayload[2]
: speedpayload[3]
must be equal to magic constant0x44
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.
payload[0]
must be equal to magic constant0x10
payload[1]
year divided by 100payload[2]
remainder of dividing year by 100payload[3]
month (1 is Jan., 2 is Feb., etc)payload[4]
day of month, starting from 1payload[5]
hours (24 hours format)payload[6]
minutespayload[7]
secondspayload[8]
day of week (SUN is 0)payload[9]
must be equal to magic constant0x00
payload[10]
must be equal to magic constant0x01
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
0x25
: Seven color cross fade0x26
: Red gradual change0x27
: Green gradual change0x28
: Blue gradual change0x29
: Yellow gradual change0x2A
: Cyan gradual change0x2B
: Purple gradual change0x2C
: White gradual change0x2D
: Red, Green cross fade0x2E
: Red blue cross fade0x2F
: Green blue cross fade0x30
: Seven color stobe flash0x31
: Red strobe flash0x32
: Green strobe flash0x33
: Blue strobe flash0x34
: Yellow strobe flash0x35
: Cyan strobe flash0x36
: Purple strobe flash0x37
: White strobe flash0x38
: 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.