Академический Документы
Профессиональный Документы
Культура Документы
User's Manual
Copyright Information
The information contained in this document is the proprietary information of Hangzhou Gubei Electronics
Technology Co., Ltd. (hereinafter referred as BroadLink). The contents are confidential and any disclosure to
persons other than the officers, employees, agents or subcontractors of the owner or licensee of this document,
without the prior written consent of BroadLink, is strictly prohibited.
Further, no portion of this document may be reproduced, stored in a retrieval system, or transmitted in any form or
by any means, electronic or mechanical, including photocopying and recording, without the prior written consent
of BroadLink, the copyright holder.
BroadLink publishes this document without making any warranty as to the content contained herein. Further
BroadLink reserves the right to make modifications, additions and deletions to this document due to
typographical errors, inaccurate information, or improvements to products mentioned in the document at any time
and without notice. Such changes will, nevertheless be incorporated into new editions of this document.
BroadLink, EasyConfig and their logos are registered trademarks of Hangzhou Gubei Electronics Technology Co.,
Ltd.
Android is the trademark of Google Inc. IOS is a trademark or registered trademark of Cisco in the U.S. and
other countries and is used under license by Apple Inc. Other marks may be mentioned herein that belong to
other companies.
Version History
www.broadlink.com.cn 2 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Table of Contents
1. Introduction...................................................................................................................................................7
2. How to use the SDK .....................................................................................................................................7
3. API Specification..........................................................................................................................................8
network_init....................................................................................................................................................10
SDK_version...................................................................................................................................................11
probe_list.........................................................................................................................................................12
device_add ......................................................................................................................................................14
device_update .................................................................................................................................................15
device_delete...................................................................................................................................................16
device_lan_ip ..................................................................................................................................................17
device_state.....................................................................................................................................................18
sp1_auth..........................................................................................................................................................18
sp1_control......................................................................................................................................................20
sp1_refresh......................................................................................................................................................21
sp1_task...........................................................................................................................................................22
sp2_refresh......................................................................................................................................................24
sp2_control......................................................................................................................................................26
sp2_task...........................................................................................................................................................27
sp2_current_power..........................................................................................................................................29
sp2_24_power.................................................................................................................................................30
sp2_week_power.............................................................................................................................................31
sp2_month_power...........................................................................................................................................32
sp2_year_power..............................................................................................................................................33
sp2_get_standby_power..................................................................................................................................35
sp2_set_standby_power..................................................................................................................................36
sp3_refresh......................................................................................................................................................37
sp3_control......................................................................................................................................................40
sp3_task...........................................................................................................................................................41
sp3_set_eleprotect...........................................................................................................................................44
sp3_set_day_saving_time ...............................................................................................................................45
www.broadlink.com.cn 3 / 53
Open API of SDK for Smart Home Mobile App – User Manual
sp3_get_day_saving_time...............................................................................................................................46
rm1_auth .........................................................................................................................................................47
rm1_study .......................................................................................................................................................48
rm1_code.........................................................................................................................................................49
rm1_send.........................................................................................................................................................50
rm2_refresh.....................................................................................................................................................51
rm2_study .......................................................................................................................................................52
rm2_code.........................................................................................................................................................52
rm2_send.........................................................................................................................................................53
rmpro_freq_scan .............................................................................................................................................54
rmpro_freq_scan_status ..................................................................................................................................55
rmpro_scan_study...........................................................................................................................................56
rmpro_cancel_study........................................................................................................................................57
a1_refresh........................................................................................................................................................58
a1_task_list .....................................................................................................................................................59
a1_add_task.....................................................................................................................................................61
a1_del_task .....................................................................................................................................................64
rmac_current_power .......................................................................................................................................66
rmac_24_power...............................................................................................................................................67
rmac_week_energy .........................................................................................................................................68
rmac_month_energy .......................................................................................................................................69
rmac_year_energy...........................................................................................................................................71
rmac_get_standby_power ...............................................................................................................................72
rmac_set_standby_power................................................................................................................................73
rmac_set_low_time.........................................................................................................................................74
rmac_get_all_energy.......................................................................................................................................75
easyconfig .......................................................................................................................................................76
Cancel easyconfig ...........................................................................................................................................77
Obtain wifi_info..............................................................................................................................................78
www.broadlink.com.cn 4 / 53
Open API of SDK for Smart Home Mobile App – User Manual
1. Introduction
BroadLink UART Data transmission SDK allows developers to directly access the easyconfig technique of
Broadlink and provides integration support for their applications of the Broadlink devices discovery and control.
Users only need to be ready for the hardware and UI,That can be completed the development of the product in the
shortest time.At the same time, it can also directly control the BroadLink intelligent products.
3. API Specification
All requests listed in the following table are in synchronous mode.
Request ID Function Comment Command
1 Network threads Using this method is the premise of the network network_init
initialization operation
2 Obtain SDK Version Obtain current SDK version information and updated
SDK_version
information contents
11 Through this interface, the list of new devices or the
Search for new
devices with updated content can be found. It requires probe_list
"device list"
users to determine whether devices are saved
12 Through this interface, devices can be added to the
Add devices to
network threads, and this step is the premise of further device_add
network threads
operations of these devices
13 Modify device Through this interface, the name and locking status of
device_update
information devices can be updated
14 Delete devices
Through this interface, devices can be deleted from
from network device_delete
network threads
threads
15 Obtain LAN IP
Through this interface, IP address of the device in
address of the
local network can be obtained device_lan_ip
devices
16 Obtain network Through this interface, current network status of the
status of devices device can be obtained device_state
41 Authenticate SP1 through this interface. Only the
SP1 login sp1_auth
authenticated devices can be controlled
42 SP1 control Through this interface, SP1 can be switched on or off sp1_control
43 SP1 refresh Through this interface, the current status of SP1 can sp1_refresh
be looked up
44 Through this interface, the periodic tasks of SP1 can
SP1 tasks sp1_task
be set up
71 SP2/SPmini Through this interface, the current state of the SP2 sp2_refresh
www.broadlink.com.cn 5 / 53
Open API of SDK for Smart Home Mobile App – User Manual
www.broadlink.com.cn 6 / 53
Open API of SDK for Smart Home Mobile App – User Manual
network_init
Arguments Example
arguments:
{
"api_id" : 1,
"command" : "network_init",
"license" : "0000000000000000000000",
"type_license" : "aaaaaaaaaaaaaaaaaaaaa",
"main_udp_ser" : "www.baidu.com",
"backup_udp_ser" : "www.sina.com.cn",
"main_tcp_ser" : "www.google.com",
"main_udp_port" : 80,
www.broadlink.com.cn 7 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"backup_udp_port" : 8080,
"main_tcp_port" : 80
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command command
license The license obtained by users when they apply for the API.
type_license The license obtained by users when they apply for the API.
backup_udp_ser Specified backup udp server domain name (Option)
main_udp_ser Specified udp server domain name (Option)
main_tcp_ser Specified tcp server domain name (Option)
main_udp_port Specified main udp port (Option, if specify the main udp server domain
name, it is must be set)
backup_udp_port Specified backup udp port (Option, if specify the backup udp server domain
name, it is must be set)
main_tcp_port Specified main tcp port (Option, if specify the tcp server domain name, it is
must be set)
Return Message
Retval:
{ "code":0,
"msg":"network init success"
}
SDK_version
Arguments Example
arguments:
{
"api_id" : 2,
"command" : "SDK_version",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
Return Message
Retval:
{ "code":0,
"version":"V1.1.0-201406091100",
"update":"V1.1.0-201406091100 update contents: ......"
}
</pre>
Arguments Specification
Arguments Name Arguments Specification
code return code
version Current SDK version
update Current SDK update content
www.broadlink.com.cn 8 / 53
Open API of SDK for Smart Home Mobile App – User Manual
probe_list
Arguments Example
arguments:
{
"api_id" : 11,
"command" : "probe_list"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
Return Message
Retval:
{ "code":0,
"msg":"Execute success!",
"list":[
{ "mac":"00:11:22:33:44:55",
"type":"SP2",
"name":" Smart Plug ",
"lock":0,
"password":987961777,
"id":0,
"subdevice":0,
"key":"097628343fe99e23765c1513accf8b02"
},
{ "mac":"00:11:22:33:44:55",
"type":"SP2",
"name":"Example",
"lock":0,
"password":912023642,
"id":0,
"subdevice":0,
"key":"097628343fe99e23765c1513accf8b02"
}
]
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
list Device property information array from the query
mac mac address of the device
type Device type, the current supported device types, SP1/SP2/RM1/RM2 (Note:should be
capitalized).
name Device name, UTF8 code.
lock Current locking state of the device
password Password required for SP1/RM1 authentication, which is generated by device and
cannot be modified.
id ID used in SP2/RM2 communication, which is generated by device and cannot be
modified.
subdevice Reserved field. Set to 0
key Key used in SP2/RM2 communication, which is generated by device and cannot be
www.broadlink.com.cn 9 / 53
Open API of SDK for Smart Home Mobile App – User Manual
device_add
Arguments Example
arguments:
{ "api_id":12,
"command":"device_add",
"mac":"00:11:22:33:44:55",
"type":"RM2",
"name":" Smart Plug ",
"lock":0,
"password":1028000492,
"id":0,
"subdevice":0,
"key":"00000000000000000000000000000000"
}
Arguments Specification
Arguments Arguments Specification
Name
api_id command ID
command Command (optional).
The following fields obtained from probe_list cannot be modified.
mac MAC address of the device.
type Device type, the current supported device types, SP1/SP2/RM1/RM2. (Note: should be
capitalized)
name Device name, UTF8 code.
lock Current locking state of the device
password Password required for SP1/RM1 authentication, which is generated by device and cannot be
modified.
id ID used in SP2/RM2 communication, which is generated by device and cannot be modified.
subdevice Reserved field. Set to 0
key Key used in SP2/RM2 communication, which is generated by device and cannot be
modified.
Return Message
Retval:
{ "code":0,
"msg":"Add device success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
www.broadlink.com.cn 10 / 53
Open API of SDK for Smart Home Mobile App – User Manual
device_update
Arguments Example
arguments:
{ "api_id":13,
"command":"device_update",
"mac":"00:11:22:33:44:55",
"name":" Smart Plug ",
"lock":0,
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac Device MAC address needs to be modified.
name Device name needs to be modified, UTF8 code.
lock Whether or not to lock
Return Message
Retval:
{ "code":0,
"msg":"Update device info success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
device_delete
Arguments Example
arguments:
{ "api_id":14,
"command":"device_delete",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional)
mac Device MAC address needs to be deleted.
Return Message
Retval:
{ "code":0,
"msg":"Delete device success"
}
www.broadlink.com.cn 11 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
device_lan_ip
Arguments Example
arguments:
{ "api_id":15,
"command":"device_lan_ip",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional)
mac Device MAC address needs to be deleted.
Return Message
Retval:
{ "code":0,
"lan_ip":"192.168.1.113",
"msg":"mac:00:11:22:33:44:55 get lan ip success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
lan_ip Current device LAN IP address.
msg return message
device_state
Arguments Example
arguments:
{ "api_id":16,
"command":"device_state",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac Device MAC address needs to be deleted.
Return Message
www.broadlink.com.cn 12 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Retval:
{ "code":0,
"status":"LOCAL",
"msg":"mac:00:11:22:33:44:55 get state success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
status current network status of the device (NOT_INIT: Not initialized Local: LAN
REMOTE: Remote OFFLINE: offline)
msg return message
sp1_auth
Arguments Example
arguments:
{ "api_id":41,
"command":"sp1_auth",
"mac":"00:11:22:33:44:55",
"password":1028000492
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device that needs to login.(mandatory)
password Device Login Password(mandatory)
Return Message
Retval:
{ "code":0,
"msg":"sp1 auth success",
"status":1,
"name":"Smart Plug 1",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00",
"off_time":"15:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--",
"off_time":"00:00",
"repeat":127
}
] "status":1
}
Arguments Specification
Arguments Name Arguments Specification
code return code
www.broadlink.com.cn 13 / 53
Open API of SDK for Smart Home Mobile App – User Manual
sp1_control
Arguments Example
arguments:
{ "api_id":42,
"command":"sp1_control",
"mac":"00:11:22:33:44:55",
"status": 0
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
status status: the status to be set (0: off; 1: on).
Return Message
Retval:
{ "code":0,
"msg":"Set sp1 status success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
sp1_refresh
Arguments Example
arguments:
{ "api_id":43,
"command":"sp1_refresh",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
www.broadlink.com.cn 14 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{ "code":0,
"msg":"Refresh sp1 status success"
"status": 0
"name":"Smart Plug 1",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00",
"off_time":"15:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--",
"off_time":"00:00",
"repeat":127
}
]
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
status current status of the SP1 device.(1: turn on, 0: turn off)
name Name of SP2
lock Whether SP2 device is locked or not
periodic_task Periodic task of SP2.
enable Enable periodic tasks of the SP1 device
on_time Start time of periodic tasks, if not set, set it to be"--:--".
off_time End time of periodic tasks, if not set, set it to be"--:--".
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4:Thursday, bit5:
Friday, bit6: Saturday).
sp1_task
Arguments Example
arguments:
{ "api_id":44,
"command":"sp1_task",
"mac":"00:11:22:33:44:55",
"name":"Smart Plug 1",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00",
www.broadlink.com.cn 15 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"off_time":"15:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--",
"off_time":"00:00",
"repeat":127
}
]
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
name Name of SP2
lock Whether SP2 device is locked or not.
periodic_task Periodic task of SP2.
enable Enable periodic task
on_time Start time of periodic tasks, if not set, set it to be"--:--".
off_time End time of periodic tasks, if not set, set it to be"--:--".
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4: Thursday,
bit5: Friday, bit6: Saturday).
Note: While setting up a task, the previous task need to be set up at the same time. Task of adding and deleting
should use the same interface. The device name and locking status also need to be set.
Retval:
{ "code":0,
"msg":"Set sp1 task success"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
msg return message
sp2_refresh
Arguments Example
arguments:
{ "api_id":71,
"command":"sp2_refresh",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
www.broadlink.com.cn 16 / 53
Open API of SDK for Smart Home Mobile App – User Manual
{ "code":0,
"msg":"Refresh sp2 status success",
"status":0
"name":"Smart Plug 2",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00",
"off_time":"15:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--",
"off_time":"00:00",
"repeat":127
}
] "timer_task":[
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":0,
"off_time":"2014-07-02 15:58:03"
},
{ "on_enable":0,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-03 16:58:03"
},
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-05 18:58:03"
}
]
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
status Current ON/OFF of Devices (0: OFF 1: ON)
name Name of SP2.
lock Whether SP2 device is locked or not.
periodic_task Periodic task of SP2.
enable Enable periodic task
on_time Start time of periodic tasks, if not set, set it to be"--:--".
off_time End time of periodic tasks, if not set, set it to be"--:--".
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1:Monday, bit2:Tuesday, bit3:Wednesday,bit4:Thursday,
bit5:Friday, bit6: Saturday).
timer_task Timer task of SP2.
on_enable Timer task.enable open.
on_time Timer task.enable open time.
off_enable Timer task.enable closure.
off_time Timer task.enable closure time.
www.broadlink.com.cn 17 / 53
Open API of SDK for Smart Home Mobile App – User Manual
sp2_control
Arguments Example
arguments:
{ "api_id":72,
"command":"sp2_control",
"mac":"00:11:22:33:44:55",
"status":1
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
status ON/OFF status to be set (0: OFF 1: ON)(mandatory)
Return Message
Retval:
{ "code":0,
"msg":"Set status success"
}
Arguments Specification
Arguments Name Arguments Specification
code return codec
msg return message
sp2_task
Arguments Example
arguments:
{ "api_id":73,
"command":"sp2_task",
"mac":"00:11:22:33:44:55",
"name":"Smart Plug 2",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00",
"off_time":"15:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--",
"off_time":"00:00",
"repeat":127
}
] "timer_task":[
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":0,
www.broadlink.com.cn 18 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"off_time":"2014-07-02 15:58:03"
},
{ "on_enable":0,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-03 16:58:03"
},
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-05 18:58:03"
}
]
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
name Name of SP2
lock Whether SP2 device is locked or not.
periodic_task Periodic task of SP2.
enable Enable periodic task
on_time Start time of periodic tasks, if not set, set it to be"--:--".
off_time End time of periodic tasks, if not set, set it to be"--:--".
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4:Thursday, bit5:
Friday, bit6: Saturday).
timer_task Timer task of SP2.
on_enable Timer task.enable open.
on_time Timer task.enable open time.
off_enable Timer task.enable closure
off_time Timer task.enable closure time.
Note: While setting up a task, the previous task need to be set up at the same time. Task of adding and deleting
should use the same interface. The device name and locking status also need to be set.
Return Message
Retval:
{ "code":0,
"msg":"Set sp2 task success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
sp2_current_power
Arguments Example
arguments:
{ "api_id":74,
"command":"sp2_current_power",
"mac":"00:11:22:33:44:55"
www.broadlink.com.cn 19 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"current_power":121.000000,
"msg":"Get sp2 current power success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
current_power Current real time power of device
msg return message
sp2_24_power
Arguments Example
arguments:
{ "api_id":75,
"command":"sp2_24_power",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"current_power":121.000000,
"24hour_power":[0.000000, 60.000000, 80.000000, ...],
"msg":"Get sp2 last 24hour power success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
current_power Current real time power of device
24hour_power SP2 power of last 24 hours, power data collected each 5 minutes and 288 data points in
total.
msg return message
www.broadlink.com.cn 20 / 53
Open API of SDK for Smart Home Mobile App – User Manual
sp2_week_power
Arguments Example
arguments:
{ "api_id":76,
"command":"sp2_week_power",
"mac":"00:11:22:33:44:55",
"week_index":2
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
week_index The specific week of current year(Start from 1)
Return Message
Retval:
{ "code":0,
"week_energy":[
{ "peak_energy":0.250000,
"low_energy":0.750000,
"on_time":50,
"standby_energy":0.180000
},
{ "peak_energy":0.450000,
"low_energy":1.250000,
"on_time":300,
"standby_energy":0.580000
}
]
"msg":"Get sp2 week's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
week_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 7 data points in total.
peak_energy Energy consumption statistic of peak electricity
low_energy Energy consumption statistic of valley electricity
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity
msg return message
sp2_month_power
Arguments Example
www.broadlink.com.cn 21 / 53
Open API of SDK for Smart Home Mobile App – User Manual
arguments:
{ "api_id":77,
"command":"sp2_month_power",
"mac":"00:11:22:33:44:55",
"year":2014,
"month_index":3
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
year Specific year
month_index Specific month
Return Message
Retval:
{ "code":0,
"month_energy":[
{ "peak_energy":0.250000,
"low_energy":0.750000,
"on_time":50,
"standby_energy":0.180000
},
{ "peak_energy":0.450000,
"low_energy":1.250000,
"on_time":300,
"standby_energy":0.580000
}
]
"msg":"Get sp2 month's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
month_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 31 data points in total
peak_energy Energy consumption statistic of peak electricity
low_energy Energy consumption statistic of valley electricity
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity
msg return message
sp2_year_power
Arguments Example
arguments:
{ "api_id":78,
"command":"sp2_year_power",
"mac":"00:11:22:33:44:55",
"year":2014
www.broadlink.com.cn 22 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
year Specific year)
Return Message
Retval:
{ "code":0,
"year_energy":[
{ "peak_energy":100.250000,
"low_energy":150.750000,
"on_time":1550,
"standby_energy":30.180000
},
{ "peak_energy":120.450000,
"low_energy":170.250000,
"on_time":3000,
"standby_energy":80.580000
}
]
"msg":"Get sp2 year's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
year_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 12 data points in total.
peak_energy Energy consumption statistic of peak electricity
low_energy Energy consumption statistic of valley electricity
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity
msg return message
sp2_get_standby_power
Arguments Example
arguments:
{ "api_id":79,
"command":"sp2_get_standby_power",
"mac":"00:11:22:33:44:55",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
www.broadlink.com.cn 23 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Retval:
{ "code":0,
"enable":1,
"standby_power":10
"msg":"Get sp2 standby power success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
enable Whether standby power takes effect or not
standby_power standby power
msg return message
sp2_set_standby_power
Arguments Example
arguments:
{ "api_id":80,
"command":"sp2_set_standby_power",
"mac":"00:11:22:33:44:55",
"enable":1,
"standby_power":5
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
enable Whether enable standby power or not
standby_power Set standby power
Retval:
{ "code":0,
"msg":"Set sp2 standby power success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
sp3_refresh
Arguments Example
arguments:
{ "api_id":82,
www.broadlink.com.cn 24 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"command":"sp3_refresh",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id Command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"Refresh status success",
"status":0
"name":"Smart Plug",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00:00",
"off_time":"15:00:00",
"repeat":0
},
{ "enable":1,
"on_time":"--:--:--",
"off_time":"00:00:00",
"repeat":127
}
]
"timer_task":[
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":0,
"off_time":"2014-07-02 15:58:03"
},
{ "on_enable":0,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-03 16:58:03"
},
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2015-07-05 18:58:03"
}
],
"random_timer_task":{
"start_time": "08:00",
"end_time":"12:00",
"repeat":0,
"enable":1
},
"cycle_timer_task":{
"start_time":"08:00:00",
"end_time":"12:00:00",
"repeat":0,
"enable":1,
www.broadlink.com.cn 25 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"on_level":60,
"off_level":100
}
"ele_protect":1,
"ele_protect_time":1,
"module_time":"2015-07-05 18:58:03"
}
Arguments Specification
Arguments Arguments Specification
code Return code
msg Return message
status Current switch status
(Spminiv2: 0: off 1:on)
(SP3: 0:all off,1:night light off,switch on
2:night light on,switch off 3:all on)
name Name of device
lock Is the device locked?
periodic_task Repeated timer
enable Enable repeated timer
on_time Set switch on time for repeated timer. Default is "--:--:--"
off_time Set switch off time for repeated timer. Default is "--:--:--"
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4:Thursday, bit5:
Friday, bit6: Saturday).
timer_task Timer task
on_enable Enable timer
on_time Start time
off_enable Disable timer
off_time End time
random_timer_task Random timer. Return null if it is not set.
start_time Start time of random timer
end_time End time of random timer
sp3_control
Arguments Sample
arguments:
{ "api_id":83,
"command":"sp3_control",
"mac":"00:11:22:33:44:55",
www.broadlink.com.cn 26 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"status":1,
"mask":0
}
Arguments Specification
参数名称 参数说明
api_id Command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
status Set switch status (required), 0:All off
1:Night light off, switch on
2:Night light on, switch off
3:All on
mask Set controllable services (required)),0:All available
1:Night light available, switch unavailable
2: light unavailable, switch available
Night
3:All unavailable
Return Message
Retval:
{ "code":0,
"msg":"Set sp3 status success"
}
Arguments Specification
Arguments Name Arguments Specification
code Return code
msg Return message
sp3_task
Arguments Sample
arguments:
{ "api_id":84,
"command":"sp3_task",
"mac":"00:11:22:33:44:55",
"name":"Smart Plug",
"lock":0,
"periodic_task":[
{ "enable":1,
"on_time":"08:00:00",
"off_time":"15:00:00",
"repeat":0,
"on_done":0,
"off_done":0,
"mask":2
},
{ "enable":1,
"on_time":"--:--:--",
"off_time":"00:00:00",
"repeat":127
www.broadlink.com.cn 27 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"on_done":0,
"off_done":0,
"mask":1
}
] "timer_task":[
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":0,
"off_time":"2014-07-02 15:58:03",
},
{ "on_enable":0,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-03 16:58:03"
},
{ "on_enable":1,
"on_time":"2014-07-02 14:58:03"
"off_enable":1,
"off_time":"2014-07-05 18:58:03"
}
],
"random_timer_task":{
"start_time": "08:00",
"end_time":"12:00",
"repeat":0,
"enable":1
}
"cycle_timer_task":{
"start_time":"08:00:00",
"end_time":"12:00:00",
"repeat":0,
"enable":1,
"on_level":60,
"off_level":100
}
}
Arguments Specification
Arguments Arguments Specification
api_id Command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
name Name of device
lock Is the device locked?
periodic_task Repeated timer(Max 16 timers can be added for switch and night light together.)
enable Enable repeated timer
on_time Set switch on time for repeated timer. Default is "--:--:--"
off_time Set switch off time for repeated timer. Default is "--:--:--"
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4:Thursday, bit5:
Friday, bit6: Saturday).
on_done Is “turn on” command executed? 0: No, 1: Yes
off_done Is “turn off” command executed? 0: No, 1: Yes
mask Set timer for switch or night light
1: Night light
www.broadlink.com.cn 28 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Note: While setting up a task, the previous task need to be set up at the same time. Task of adding and deleting
should use the same interface. The device name and locking status also need to be set.
Return Message
Retval:
{ "code":0,
"msg":"Set task success"
}
Arguments Specification
Arguments Name Arguments Specification
code Return code
msg Return message
sp3_set_eleprotect
Arguments Sample
arguments:
{ "api_id":85,
"command":"sp3_set_eleprotect",
"mac":"00:11:22:33:44:55",
"enable":1,
"time":3600
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
enable Charging protection (all timers will be disabled during the charging protection period)
1: Enable
2: Disable
www.broadlink.com.cn 29 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{ "code":0,
"msg":"Set eleprotect success"
}
Arguments Specification
Arguments Arguments Specification
code Return code
msg Return message
sp3_set_day_saving_time
Arguments Sample
arguments:
{ "api_id":86,
"command":"sp3_set_day_saving_time",
"mac":"00:11:22:33:44:55",
"enable":1,
"start_time":"2015-11-15 08:00:00",
"end_time":"2015-11-15 15:00:00",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
enable Daylight saving function (for some available functions)
1: Enable
2: Disable
start_time Start time of daylight saving
end_time End time of daylight saving
Return Message
Retval:
{ "code":0,
"msg":"Set day saving time success"
}
Arguments Specification
Arguments Name Arguments Specification
code Return code
msg Return message
www.broadlink.com.cn 30 / 53
Open API of SDK for Smart Home Mobile App – User Manual
sp3_get_day_saving_time
Arguments Sample
arguments:
{ "api_id":87,
"command":"sp3_get_day_saving_time",
"mac":"00:11:22:33:44:55",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"get day saving time success",
"enable":1,
"start_time":"2015-11-15 08:00:00",
"end_time":"2015-11-15 15:00:00"
}
Arguments Specification
Arguments Name Arguments Specification
code Return code
msg Return message
enable Daylight saving function (for some available functions)
1: Enable
2: Disable
start_time Start time of daylight saving
end_time End time of daylight saving
rm1_auth
Arguments Example
arguments:
{ "api_id":101,
"command":"rm1_auth",
"mac":"00:11:22:33:44:55",
"password":1028000492
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
www.broadlink.com.cn 31 / 53
Open API of SDK for Smart Home Mobile App – User Manual
{ "code":0,
"temperature":23.100000,
"msg":"rm1 auth success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
temperature Current ambient temperature of the device
msg return message
rm1_study
Arguments Example
arguments:
{ "api_id":102,
"command":"rm1_study",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"rm1 enter study mode success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
rm1_code
Arguments Example
arguments:
{ "api_id":103,
"command":"rm1_code",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional)
www.broadlink.com.cn 32 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{
"code":-100,
"msg":"rm1 check data failed"
}
Retval:
{"code":0,
"data":"2600e6006f390e2a0e290d100d100e0f0e290e0f0e0f0e2a0e290d100e2a0e0e0f0e0e2a0d2a0e0f0e2a0e",
"msg":"rm1 check data success"
}
Arguments Specification
Arguments Name Arguments Specification
code Return code, -100 means no learning data found, while 0 means learning data found.
data Learned control code
msg return message
rm1_send
Arguments Example
arguments:
{ "api_id":104,
"command":"rm1_send",
"mac":"00:11:22:33:44:55",
"data":"2600e6006f390e2a0e290d100d100e0f0e290e0f0e0f0e2a0e290d100e2a0e0e0f0e0e2a0d2a0e0f0e2a0e"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"rm1 send data success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
www.broadlink.com.cn 33 / 53
Open API of SDK for Smart Home Mobile App – User Manual
rm2_refresh
Arguments Example
arguments:
{ "api_id":131,
"command":"rm2_refresh",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"temperature":23.100000,
"msg":"Refresh rm2 status success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
temperature Current ambient temperature of the device
msg return message
rm2_study
Arguments Example
arguments:
{ "api_id":132,
"command":"rm2_study",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"rm2 enter study mode success"
}
Arguments Specification
Arguments Name Arguments Specification
www.broadlink.com.cn 34 / 53
Open API of SDK for Smart Home Mobile App – User Manual
rm2_code
Arguments Example
arguments:
{ "api_id":133,
"command":"rm2_code",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated
Return Message
Retval:
{
"code":-1,
"msg":"rm2 check data failed"
}
Retval:
{ "code":0,
"data":"2600e6006f390e2a0e290d100d100e0f0e290e0f0e0f0e2a0e290d100e2a0e0e0f0e0e2a0d2a0e0f0e2a0e",
"msg":"rm2 check data success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
data Learned control code
msg return message
rm2_send
Arguments Example
arguments:
{ "api_id":134,
"command":"rm2_send",
"mac":"00:11:22:33:44:55",
"data":"2600e6006f390e2a0e290d100d100e0f0e290e0f0e0f0e2a0e290d100e2a0e0e0f0e0e2a0d2a0e0f0e2a0e"
}
Arguments Specification
www.broadlink.com.cn 35 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{ "code":0,
"msg":"rm2 send data success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
rmpro_freq_scan
Arguments Example
arguments:
{ "api_id":135,
"command":"rmpro_freq_scan",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"Set freq scan success."
}
Return Message
Return Message Arguments Specification
code return code
msg return message
rmpro_freq_scan_status
Arguments Example
arguments:
{ "api_id":136,
"command":"rmpro_freq_scan_status",
"mac":"00:11:22:33:44:55"
}
www.broadlink.com.cn 36 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"Get freq scan status success",
"status":1,
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
status Get scanning frequency status,0:not start or scanning,1:success,4:fail
rmpro_scan_study
Arguments Example
arguments:
{ "api_id":137,
"command":"rmpro_scan_study",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"Enter study mode success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
rmpro_cancel_study
Arguments Example
www.broadlink.com.cn 37 / 53
Open API of SDK for Smart Home Mobile App – User Manual
arguments:
{ "api_id":138,
"command":"rmpro_cancel_study",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"msg":"Cancel study mode success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
a1_refresh
Arguments Example
arguments:
{ "api_id":161,
"command":"a1_refresh",
"mac":"00:11:22:33:44:55",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"temperature":25.0,
"humidity":56.3,
"light":3,
"air":2,
"noisy":1,
"name":"A1 Eair",
"lock":0,
"msg":"Refresh a1 sensor's value success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
temperature temperature, floating-point type
www.broadlink.com.cn 38 / 53
Open API of SDK for Smart Home Mobile App – User Manual
a1_task_list
Arguments Example
arguments:
{ "api_id":162,
"command":"a1_task_list",
"mac":"00:11:22:33:44:55",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0, “list”:[
{
"mac": "00:11:22:33:44:55",
"time_enable":0,
"task_enable":1,
"index":0,
"start_time":"10:30",
"end_time":"18:30",
"repeat":7, "sensor_type":0,
"sensor_trigger": 0,
"sensor_value":25.0,
"task_name":" Turn on TV "
},
{
"mac": "55:44:33:22:11:00",
"time_enable":1,
"task_enable":1,
"index":2,
"start_time":"10:30",
"end_time":"17:30",
"repeat":5,
"sensor_type":2,
"sensor_trigger": 1,
"sensor_value":3.0,
"task_name":" Turn on audio "
}
],
www.broadlink.com.cn 39 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
code return code
code return code
list Task list
mac Mac address of the device to execute tasks.
time_enable Time enable Integer
task_enable Task enable Integer
index Task Number, (used when deleting task) Integer
start_time Start time of task executing String
end_time End time of task executing String
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1: Monday, bit2: Tuesday, bit3: Wednesday, bit4:Thursday, bit5:
Friday, bit6: Saturday). Integer
sensor_type Sensor types of the task execution condition (0: temperature 1:humidity
2:illuminance 3:air quality 4:noise). Integer
sensor_trigger The change in the trend of the sensor value of the task execution condition (0:rise 1:
fall) Integer
sensor_value The sensor value of the task execution condition. float
task_name Name of the executed task. String
msg return message
a1_add_task
Arguments Example
arguments:
{ "api_id":163,
"command":"a1_add_task",
"mac":"00:11:22:33:44:55",
"task_name": " Turn off air con ",
"time_enable": 1,
"task_enable": 1,
"start_time": "2014-06-06 10:30:00",
"end_time": "2014-06-06 18:30:00",
"repeat": 7,
"sensor_type": 0,
"sensor_trigger": 1,
"sensor_value" : 20.0,
"device_mac": "aa:bb:cc:dd:ee:ff",
"device_id": 25,
"device_key": "097628343fe99e23765c1513accf8b02",
"device_type": "RM2",
"task_data":"2600e6006f390e2a0e290d100d100e0f0e290e0f0e0f0e2a0e290d100e2a0e0e0f0e0e2a0d2a0e0f0e2a0e",
"status": 0
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
www.broadlink.com.cn 40 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{ "code":0, “list”:[
{
"mac": "00:11:22:33:44:55",
"time_enable":0,
"task_enable":1,
"index":0,
"start_time":"10:30",
"end_time":"18:30",
"repeat":7,
"sensor_type":0,
"sensor_trigger": 0,
"sensor_value":25.0,
"task_name":" Turn on TV "
},
{
"mac": "55:44:33:22:11:00",
"time_enable":1,
"task_enable":1,
"index":2,
"start_time":"10:30",
"end_time":"17:30",
"repeat":5,
"sensor_type":2,
"sensor_trigger": 1,
"sensor_value":3.0,
"task_name":" Turn on audio "
}
],
"msg":"Get a1 task list success"
www.broadlink.com.cn 41 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
code return code
list Task list
mac Mac address of the device to execute tasks.
time_enable Time enable Integer
task_enable Task enable Integer
index Task Number, (used when deleting task) Integer
start_time Start time of task executing String
end_time End time of task executing String
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1:Monday, bit2:Tuesday, bit 3:Wednesday,bit4:Thursday,
bit5:Friday, bit6: Saturday). Integer
sensor_type Sensor types of the task execution condition (0: temperature 1:humidity
2:illuminance 3:air quality 4:noise). Integer
sensor_trigger The change in the trend of the sensor value of the task execution condition (0:rise 1:
fall) Integer
sensor_value The sensor value of the task execution condition. float
task_name Name of the executed task. String
msg return message
a1_del_task
Arguments Example
arguments:
{ "api_id":164,
"command":"a1_del_task",
"mac":"00:11:22:33:44:55",
"index": 0
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
index The index of tasks need to be deleted. (The value is obtained from the returned list)
Return Message
Retval:
{ "code":0, “list”:[
{
"mac": "00:11:22:33:44:55",
"time_enable":0,
"task_enable":1,
"index":0,
"start_time":"10:30",
"end_time":"18:30",
"repeat":7,
"sensor_type":0,
"sensor_trigger": 0,
www.broadlink.com.cn 42 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"sensor_value":25.0,
"task_name":" Turn on TV "
},
{
"mac": "55:44:33:22:11:00",
"time_enable":1,
"task_enable":1,
"index":2,
"start_time":"10:30",
"end_time":"17:30",
"repeat":5, "sensor_type":2,
"sensor_trigger": 1,
"sensor_value":3.0,
"task_name":" Turn on audio "
}
],
"msg":"Get a1 task list success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
list Task list
mac Mac address of the device to execute tasks.
time_enable Time enable Integer
task_enable Task enable Integer
index Task Number, (used when deleting task) Integer
start_time Start time of task executing String
end_time End time of task executing String
repeat Repetitive cycles of periodic tasks in one-week iteration, 0 means task is only executed
once (bit0: Sunday, bit1:Monday, bit2:Tuesday, bit3:Wednesday,bit4:Thursday,
bit5:Friday, bit6: Saturday). Integer
sensor_type Sensor types of the task execution condition (0: temperature 1:humidity
2:illuminance 3:air quality 4:noise). Integer
sensor_trigger The change in the trend of the sensor value of the task execution condition (0:rise 1:
fall) Integer
sensor_value The sensor value of the task execution condition. float
task_name Name of the executed task. String
msg return message
rmac_current_power
Arguments Example
arguments:
{ "api_id":190,
"command":"rmac_current_power",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
www.broadlink.com.cn 43 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Return Message
Retval:
{ "code":0,
"current_power":121.000000,
"msg":"Get rmac current power success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
current_power Device current real time power(unit:W)
msg return message
rmac_24_power
Arguments Example
arguments:
{ "api_id":191,
"command":"rmac_24_power",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
{ "code":0,
"current_power":121.000000,
"24hour_power":[0.000000, 60.000000, 80.00000
0, ...],
"msg":"Get rmac last 24hour power success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
current_power Device current real time power(unit:W)
24hour_power RMAC power of last 24 hours, power data collected each 5 minutes and 288 data points
in total.
msg return message
www.broadlink.com.cn 44 / 53
Open API of SDK for Smart Home Mobile App – User Manual
rmac_week_energy
Arguments Example
arguments:
{ "api_id":192,
"command":"rmac_week_energy",
"mac":"00:11:22:33:44:55",
"week_index":2
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
week_index The specific week of current year(Start from 1)
Return Message
Retval:
{ "code":0,
"week_energy":[
{ "on_time":50,
"standby_energy":0.180000,
"peak_energy":0.250000,
"low_energy":0.750000
},
{ "on_time":300,
"standby_energy":0.580000,
"peak_energy":0.450000,
"low_energy":1.250000
}
]
"msg":"Get rmac week's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
week_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 7 data points in total.
peak_energy Energy consumption statistic of peak electricity(unit:KWH)
low_energy Energy consumption statistic of valley electricity(unit:KWH)
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity(unit:KWH)
msg return message
rmac_month_energy
Arguments Example
arguments:
{ "api_id":193,
www.broadlink.com.cn 45 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"command":"rmac_month_energy",
"mac":"00:11:22:33:44:55",
"year":2016,
"month_index":1
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional)
mac Mac address of the device to execute tasks.
year Specific year
month_index The specific month of current year(Start from 1)
Return Message
Retval:
{ "code":0,
"month_energy":[
{ "on_time":50,
"standby_energy":0.180000,
"peak_energy":0.250000,
"low_energy":0.750000
},
{ "on_time":300,
"standby_energy":0.580000,
"peak_energy":0.450000,
"low_energy":1.250000
}
]
"msg":"Get rmac month's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
month_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 31 data points in total.
peak_energy Energy consumption statistic of peak electricity(unit:KWH)
low_energy Energy consumption statistic of valley electricity(unit:KWH)
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity(unit:KWH)
msg return message
rmac_year_energy
Arguments Examplearguments:
{ "api_id":194,
"command":"rmac_year_energy",
"mac":"00:11:22:33:44:55",
"year":2015
}
www.broadlink.com.cn 46 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
year Specific year
Return Message
Retval:
{ "code":0,
"year_energy":[
{"on_time":1550,
"standby_energy":30.180000,
"peak_energy":100.250000,
"low_energy":150.750000
},
{ "on_time":3000,
"standby_energy":80.580000,
"peak_energy":120.450000,
"low_energy":170.250000
}
]
"msg":"Get rmac year's energy info success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
year_energy Device energy consumption statistics of a specific week, consumption data collected
each day and 12 data points in total.
peak_energy Energy consumption statistic of peak electricity(unit:KWH)
low_energy Energy consumption statistic of valley electricity(unit:KWH)
on_time Operation Time
standby_energy Energy consumption statistic of peak electricity(unit:KWH)
msg return message
rmac_get_standby_power
Arguments Example
arguments:
{ "api_id":195,
"command":"rmac_get_standby_power",
"mac":"00:11:22:33:44:55",
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Return Message
Retval:
www.broadlink.com.cn 47 / 53
Open API of SDK for Smart Home Mobile App – User Manual
{ "code":0,
"enable":1,
"standby_power":10
"msg":"Get rmac standby power success."
}
Arguments Specification
Arguments Name Arguments Specification
code command ID
enable Whether standby power takes effect or not,1-on,0-off
standby_power standby power(unit:W)
msg return message
rmac_set_standby_power
Arguments Example
arguments:
{ "api_id":196,
"command":"rmac_set_standby_power",
"mac":"00:11:22:33:44:55",
"enable":1,
"standby_power":5
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated
enable Whether enable standby power or not,1-on,0-off
standby_power Set standby power(unit:W)
Retval:
{ "code":0,
"msg":"Set rmac standby power success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
rmac_set_low_time
Arguments Example
arguments:
{ "api_id":197,
"command":"rmac_set_low_time",
"mac":"00:11:22:33:44:55",
"start_hour":20,
www.broadlink.com.cn 48 / 53
Open API of SDK for Smart Home Mobile App – User Manual
"start_min":10,
"end_hour":22,
"end_min":10
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
start_hour valley electricity start time -hour part
start_min valley electricity start time -min part
end_hour valley electricity end time- hour part
end_min valley electricity end time - min part
Retval:
{ "code":0,
"msg":"Set rmac standby power success."
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
rmac_get_all_energy
Arguments Example
arguments:
{ "api_id":198,
"command":"rmac_get_all_energy",
"mac":"00:11:22:33:44:55"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be manipulated.
Retval:
{ "code":0,
"msg":"get rmac all energy success."
"energy": 0,
"voltage": 0,
"current": 0,
"frequent": 0,
"active_power": 0,
"reactive_power": 0,
"apparent_power": 0,
"power_factor": 0,
}
Arguments Specification
Arguments Name Arguments Specification
www.broadlink.com.cn 49 / 53
Open API of SDK for Smart Home Mobile App – User Manual
easyconfig
Arguments Example
arguments:
{ "api_id":10000,
"command":"easyconfig",
"ssid":"abcdefg",
"password":"11111111",
"broadlinkv2":1,
"dst":"192.168.3.1"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
ssid Name of network that the device will connect to. (mandatory)
password Password of network that the device will connect to. (mandatory)
broadlinkv2 Whether the device need to be configured uses the second and later generation
broadlink wireless module or not. (optional, the default setting is second generation
module))
dst (required, filling the gateway address can accelerate the configuration speed)
*Note: the interface is not thread-safe*
Retval:
{ "code":0,
"msg":"easyconfig success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
Cancel easyconfig
Arguments Example
www.broadlink.com.cn 50 / 53
Open API of SDK for Smart Home Mobile App – User Manual
arguments:
{ "api_id":10001,
"command":"cancel_easyconfig"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
Return Message
*Note: the interface is not thread-safe*
Retval:
{ "code":0,
"msg":"easyconfig success"
}
Arguments Specification
Arguments Name Arguments Specification
code return code
msg return message
Obtain wifi_info
Arguments Example
arguments:
{ "api_id":10002,
"command":"wifi_info",
"mac":"11:22:33:44:55:66",
"ipaddr":"192.168.1.1"
}
Arguments Specification
Arguments Name Arguments Specification
api_id command ID
command Command (optional).
mac MAC address of the device needs to be obtained. (Mandatory)
ipaddr IP address of current connected router(Mandatory)
Return Message
Retval:
{ "code":0,
"msg":"Get wifi info success",
"info":
{
"ssid":"ChinaNet",
"pwd":"12345678"
}
}
Arguments Specification
Arguments Name Arguments Specification
code code: return code 0 means success, others means error; if return -100 means not support
this command
www.broadlink.com.cn 51 / 53
Open API of SDK for Smart Home Mobile App – User Manual
Note: Except the explained return code, the corresponding error informations of rest return code are shown below
Return code Info
0 Success
-1 The network that devices are connected to or the password of the network has been changed.
The device has logged in at another location, if there is a need to continue to control the
-2
device, please log in again (Especially for rm1/sp1)
-3 The device is offline
-4 Unsupported operations
-5 Storage space is full
-6 Data structure is abnormal
Device has been reset, and need to enter the LAN for a new configuration. (especially for the
-7
device beyond sp1/rm1)
-100 Timeout
-101 Network thread cannot find the device
-102 There is not enough memory
-103 The device is uninitialized
-104 Network thread has been suspended
-105 Type of return message is error
-106 Operations are too frequent
-107 The server has declined the operation of this license, please contact the custmer sevice
-108 The device is not connected to the LAN
-10000 Unknown error
www.broadlink.com.cn 52 / 53
Open API of SDK for Smart Home Mobile App – User Manual
www.broadlink.com.cn 53 / 53