Skip to content

Commit

Permalink
Create api.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
directman66 committed Sep 3, 2018
1 parent 0b00688 commit 3d81cba
Showing 1 changed file with 145 additions and 0 deletions.
145 changes: 145 additions & 0 deletions modules/magichome/api.txt
@@ -0,0 +1,145 @@
RGBW WIFI Bulb Command Definition
Device Type Code:0x44 Version:0x04
---------------------------------------
Command title Command Format
0x10 command of syncing time:
Send 【0X10】+【0x14】+【10 digit and single digit of year】+【month】+【day】+【hour】+【minute】+【second】+【week】+【reserved for future use:0x0】+【0xF0 remote,0x0F local】+【check digit】(length of command:12)

Return 【0xF0 remote,0x0F local】+ 【0X10】+ 【0x00】+【check digit】(length of command:4)
---------------------------------------
0x11 command of requesting time :
Send 【0X11】+【0X1A】+【0X1B】+【0xF0 remote,0x0F local】+【check digit】(length of command:5)

Return 【0xF0 remote,0x0F local】+【0X11】+【0x14】+【10 digit and single digit of year】+【month】+【day】+【hour】+【minute】+【second】+【week】+【reserved for future use:0x0】+【check digit】(length of command:12)
---------------------------------------
0x21 command of setting timing content:
Send 【0X21】+
【Timer switch for time 1】+【10 digit and single digit of year for time 1】+【month for time 1】+【day for time 1】+【hour for time 1】+【minute for time 1】+【second for time 1】+【week for time 1】+【mode for time 1】+【32bit Value1~Value4 for time 1】+【switch for time 1】+
【Timer switch for time 2】+【10 digit and single digit of year for time 2】+【month for time 2】+【day for time 2】+【hour for time 2】+【minute for time 2】+【second for time 2】+【week for time 2】+【mode for time 2】+【32bit Value1~Value4 for time 2】+【switch for time 2】+
【Timer switch for time 3】+【10 digit and single digit of year for time 3】+【month for time 3】+【day for time 3】+【hour for time 3】+【minute for time 3】+【second for time 3】+【week for time 3】+【mode for time 3】+【32bit Value1~Value4 for time 3】+【switch for time 3】+
【Timer switch for time 4】+【10 digit and single digit of year for time 4】+【month for time 4】+【day for time 4】+【hour for time 4】+【minute for time 4】+【second for time 4】+【week for time 4】+【mode for time 3】+【32bit Value1~Value4 for time 4】+【switch for time 4】+
【Timer switch for time 5】+【10 digit and single digit of year for time 5】+【month for time 5】+【day for time 5】+【hour for time 5】+【minute for time 5】+【second for time 5】+【week for time 5】+【mode for time 5】+【32bit Value1~Value4 for time 5】+【switch for time 5】+
【Timer switch for time 6】+【10 digit and single digit of year for time 6】+【month for time 6】+【day for time 6】+【hour for time 6】+【minute for time 6】+【second for time 6】+【week for time 6】+【mode for time 6】+【32bit Value1~Value4 for time 6】+【switch for time 6】+
【Reserved bits:0x0】+【0xF0 remote,0x0F local】+【check digit】(length of command:88)

Return 【0xF0 remote,0x0F local】+ 【0X21】+ 【0x00】+【check digit】(length of command:4)
"Note:Send command of timing content
1.when mode value is 0x61,value 1,2,3 and 4 means value of RGBW separately.In addition,RGB and W cannot lihgt together.In this command,either value of RGB or W must be 0.If both value of RGB and W are not 0,then W will be 0.
2.when mode value is 0x00,do not mind value 1~value 4.Bulbs'RGBW value will same as the previous.
3.when mode value is not 0x61,it is dynamic mode value.Value1 means speed,range is from 0x01 to 0x1f.
4.Timing available:when value is 0xF0,timing works;when value is 0x0F,timing doesn't work.
5.Timing switcher:when value is 0xF0,it means ""turn on"";when value is 0x0F,it means ""turn off""
6.Week:when setting cycle timing,bit0 is empty,bit 1~bit 7 correspond Monday,Tuesday,Wendnesday~Sunday.For example,bit 7 is Sunday.
---------------------------------------
0x22 command of requesting time content
Send 【0X22】+【0X2A】+【0X2B】+【0xF0remote,0x0F local】+【check digit】(length of command:5)

Return 【0xF0 remote,0x0F local】+【0X22】+
【Timer switch for time 1】+【10 digit and single digit of year for time 1】+【month for time 1】+【day for time 1】+【hour for time 1】+【minute for time 1】+【second for time 1】+【week for time 1】+【mode for time 1】+【32bit Value1~Value4 for time 1】+【switch for time 1】+
【Timer switch for time 2】+【10 digit and single digit of year for time 2】+【month for time 2】+【day for time 2】+【hour for time 2】+【minute for time 2】+【second for time 2】+【week for time 2】+【mode for time 2】+【32bit Value1~Value4 for time 2】+【switch for time 2】+
【Timer switch for time 3】+【10 digit and single digit of year for time 3】+【month for time 3】+【day for time 3】+【hour for time 3】+【minute for time 3】+【second for time 3】+【week for time 3】+【mode for time 3】+【32bit Value1~Value4 for time 3】+【switch for time 3】+
【Timer switch for time 4】+【10 digit and single digit of year for time 4】+【month for time 4】+【day for time 4】+【hour for time 4】+【minute for time 4】+【second for time 4】+【week for time 4】+【mode for time 3】+【32bit Value1~Value4 for time 4】+【switch for time 4】+
【Timer switch for time 5】+【10 digit and single digit of year for time 5】+【month for time 5】+【day for time 5】+【hour for time 5】+【minute for time 5】+【second for time 5】+【week for time 5】+【mode for time 5】+【32bit Value1~Value4 for time 5】+【switch for time 5】+
【Timer switch for time 6】+【10 digit and single digit of year for time 6】+【month for time 6】+【day for time 6】+【hour for time 6】+【minute for time 6】+【second for time 6】+【week for time 6】+【mode for time 6】+【32bit Value1~Value4 for time 6】+【switch for time 6】+
【reserved for future use:0x0】+【check digit】(length of command:88)
---------------------------------------
0x31 command of setting color and color temperature
Send 【0X31】+【8bit red data 】+【8bit green data】+【8bit blue data】+【8bit warm white data】+【8bit status sign】+【0xF0 remote,0x0F local】+【check digit】(length of command:8)

Return Local(0x0F):no return
Remote(0xF0):【0xF0 remote】+ 【0X31】+【0x00】+【check digit】 Status sign:【0XF0】 means changing RGB,【0X0F】means W
Note:phone send commands which control static color.Range of static color value is 00-0xff.When value is 0,PWM is 0%;when value is 0XFF,PWM is 100%;
---------------------------------------
0x41 command of setting color,color temperature(in music mode,this value will not be saved)
Send 【0X41】+【8bit red value】+【8bit green data】+【8bit blue data】+【8bit warm white data】+【8bit status sign】+【0x0F local】+【check digit】(length of command:8)

Return No return
Status sign:【0XF0】means changing RGB,【0X0F】means changing W
---------------------------------------
0x51 command of setting command of custom mode
Send 【0X51】+【First point 32bit color value】+【Second point 32bit color value】+【Third point 32bit color value】+
【Fourth point 32bit color value】+【Fifth point 32bit color value】+【Sixth point 32bit color value】+
【Seventh point 32bit color value】+【Eighth point 32bit color value】+【Ninth point 32bit color value】+
【Tenth point 32bit color value】+【Eleventh point 32bit color value】+【Twelfth point 32bit color value】+
【Thirteenth point 32bit color value】+【Fourteenth point 32bit color value】+【Fifteenth point 32bit color value】+
【Sixteenth point 32bit color value】+【8bit speed value】+【8bit mode value】+
【0XFF】+【0xF0 remote,0x0F local】+【check digit】(length of command:55)"

Return "If command is local(0x0F):no return
If command is remote (0xF0):【0xF0 remote】+ 【0X51】+【0x00】+【check digit】"
Note:In command of custom mode,value of RGB cannot be 0x01,0x02,0x03.Otherwise,RGB is over.
---------------------------------------
0x52 command of requesting custom mode's content
Send 【0X52】+【0X5A】+【0X5B】+【0xF0 remote,0x0F local】+【check digit】(length of command:5)

Return "【0xF0 remote,0x0F local】+【【0X52】+【First point 32bit color value】+【Second point 32bit color value】+【Third point 32bit color value】+
【Fourth point 32bit color value】+【Fifth point 32bit color value】+【Sixth point 32bit color value】+
【Seventh point 32bit color value】+【Eighth point 32bit color value】+【Ninth point 32bit color value】+
【Tenth point 32bit color value】+【Eleven point 32bit color value】+【Twelfth point 32bit color value】+
【Thirteenth point 32bit color value】+【Fourteenth point 32bit color value】+【Fifteenth point 32bit color value】+
【Sixteenth point 32bit color value】+【8bit speed value】+【8bit changing mode value】+
【0XFF】+【check digit】(length of command:70)"
---------------------------------------
0x61 command of setting builted-in mode
Send 【0x61】+【8bit mode value】+【8bit speed value】+【0xF0 remote,0x0F local】+【check digit】(length of command:5)
Return If command is local(0x0F):no return
If command is remote (0xF0):【0xF0 remote】+ 【0X61】+【0x00】+【check digit】"
Note:mode value refers to definition in the end of file,range of speed value is 0x01--0x1F
---------------------------------------
0x71 command of setting key's value(switcher command) command

Send 【0X71】+【8bit value】+【0xF0remote,0x0F local】+【check digit】(length of command:4)
Reurn 【0xF0remote,0x0F local】+ 【0X71】+【switcher status value】+【check digit】
Note:key value0x23 means "turn on",0x24 means "turn off"
---------------------------------------
0x81 command of requesting devices'status
Send 【0X81】+【0X8A】+【0X8B】+【check digit】(length of comman:4)

Return 【0X81】+【8bit device name】+【8bit turn on/off】+【8bit mode value】+【8bit run/pause】+ 【8bit speed value】+【8bit red value】+【8bit green data】+【8bit blue data】+ 【8bit warm white data】+【version NO】+【8bit cool white data】+【8bit status sign】+【check digit】(length of command:14)
"Note:when module received command of checking devices's status,module will reply,
【8bit turn on/off】:0x23 means turn on;0x24 means turn off
【8bit run/pause status】:0x20 means status in present,0x21 means pause status,it is unuseful in this item
【8bit speed value】means speed value of dynamic model,range:0x01-0x1f,0x01 is the fast
Status sign:【0XF0】means RGB,【0X0F】means W"
---------------------------------------
RGBW value definition
COLOR R 0x00--0xFF
G 0x00--0xFF
B 0x00--0xFF
W 0x00--0xFF
C 0x00--0xFF
SPEED SPEED 0x01--0x1F
KEY PAUSE 0x20
PLAY 0x21
SWITCH 0x22
POWER ON 0x23
POWER OFF 0x24
CHANGING gradual 0x3A
jump 0x3B
flash 0x3C
MODE 1:7 colors gradual change 0x25
2:red gradual change 0x26
3:green gradual change 0x27
4:glue gradual change 0x28
5:yellow gradual change 0x29
6:cyan gradual change 0x2A
7:purple gradual change 0x2B
8:white gradual change 0x2C
9:red and green gradual change 0x2D
10:red and blue gradual change 0x2E
11:green and blue gradual change 0x2F
12:7 colors stroboflash 0x30
13:red stroboflash 0x31
14:green stroboflash 0x32
15:glue stroboflash 0x33
16:yellow stroboflash 0x34
17:cyan stroboflash 0x35
18:purple stroboflash 0x36
19:white stroboflash 0x37
20:7 colors jump change 0x38
custom Mode 0x60
static Mode 0x61
music Mode 0x62
testing Mode 0x63

Description check digit:a byte sum which a whole command minus "check digit"

0 comments on commit 3d81cba

Please sign in to comment.