- Bulb ⇐
Device
Bulb Device.
TP-Link models: LB100, LB110, LB120, LB130.
- Lighting
Lighting
- BulbSchedule
BulbSchedule
- Client ⇐
EventEmitter
Client that sends commands to specified devices or discover devices on the local subnet.
- Contains factory methods to create devices.
- Events are emitted after #startDiscovery is called.
- Device ⇐
EventEmitter
TP-Link Device.
- Netif
Netif
- Away
Away
- Plug ⇐
Device
Plug Device.
TP-Link models: HS100, HS105, HS110, HS200.
Emits events after device status is queried, such as #getSysInfo and #getEmeterRealtime.
- PlugSchedule
PlugSchedule
- Timer
Timer
- Cloud
Cloud
- Emeter
Eemter
- Schedule
Schedule
- Time
Time
- ResponseError ⇐
Error
Represents an error result received from a TP-Link device.
Where response err_code != 0.
- SendOptions :
Object
Send Options.
Bulb ⇐ Device
Bulb Device.
TP-Link models: LB100, LB110, LB120, LB130.
Kind: global class
Extends: Device
, EventEmitter
Emits: lightstate-on
, lightstate-off
, lightstate-change
, lightstate-update
, emeter-realtime-update
- Bulb ⇐
Device
- new Bulb(options)
- .cloud
- .getInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .bind(username, password, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .unbind([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getFirmwareList([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setServerUrl(server, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getInfo([sendOptions]) ⇒
- .emeter
- .realtime ⇒
Object
- .getRealtime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .realtime ⇒
- .lighting
- .lightState ⇒
Object
- .getLightState([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setLightState(options, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .lightState ⇒
- .schedule
- .getNextAction([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getNextAction([sendOptions]) ⇒
- .time
- .getTime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTimezone([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTime([sendOptions]) ⇒
- .sysInfo ⇒
Object
- .supportsBrightness ⇒
boolean
- .supportsColor ⇒
boolean
- .supportsColorTemperature ⇒
boolean
- .getColorTemperatureRange ⇒
Object
- .alias ⇒
string
- .deviceId ⇒
string
- .description ⇒
string
- .model ⇒
string
- .name ⇒
string
- .type ⇒
string
- .deviceType ⇒
string
- .softwareVersion ⇒
string
- .hardwareVersion ⇒
string
- .mac ⇒
string
- .macNormalized ⇒
string
- .getInfo([sendOptions]) ⇒
Promise.<Object, Error>
- .getPowerState([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setPowerState(value, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .togglePowerState([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .send(payload, [sendOptions]) ⇒
Promise.<Object, Error>
- .sendCommand(command, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .startPolling(interval) ⇒
Device
|Bulb
|Plug
- .stopPolling()
- .getSysInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setAlias(alias, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setLocation(latitude, longitude, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getModel([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reboot(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reset(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- "emeter-realtime-update"
- "lightstate-on"
- "lightstate-off"
- "lightstate-change"
- "lightstate-update"
Created by Client - Do not instantiate directly.
See Device#constructor for common options.
Param | Type |
---|---|
options | Object |
Kind: instance property of Bulb
- .cloud
- .getInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .bind(username, password, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .unbind([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getFirmwareList([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setServerUrl(server, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getInfo([sendOptions]) ⇒
Gets device's TP-Link cloud info.
Requests cloud.get_info
.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Add device to TP-Link cloud.
Sends cloud.bind
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
username | string |
password | string |
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.unbind
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.get_intl_fw_list
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets device's TP-Link cloud server URL.
Sends cloud.set_server_url
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Description |
---|---|---|
server | string |
URL |
[sendOptions] | SendOptions |
Kind: instance property of Bulb
- .emeter
- .realtime ⇒
Object
- .getRealtime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .realtime ⇒
Returns cached results from last retrieval of emeter.get_realtime
.
Kind: instance property of emeter
Gets device's current energy stats.
Requests emeter.get_realtime
.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Get Daily Emeter Statisics.
Sends emeter.get_daystat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Emeter Statisics.
Sends emeter.get_monthstat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Emeter Statistics.
Sends emeter.erase_runtime_stat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Kind: instance property of Bulb
- .lighting
- .lightState ⇒
Object
- .getLightState([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setLightState(options, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .lightState ⇒
Returns cached results from last retrieval of lightingservice.get_light_state
.
Kind: instance property of lighting
Get Bulb light state.
Requests lightingservice.get_light_state
.
Kind: instance method of lighting
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets Bulb light state (on/off, brightness, color, etc).
Sends lightingservice.transition_light_state
command.
Kind: instance method of lighting
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
[options.transition_period] | number |
(ms) | |
[options.on_off] | boolean |
||
[options.mode] | string |
||
[options.hue] | number |
0-360 | |
[options.saturation] | number |
0-100 | |
[options.brightness] | number |
0-100 | |
[options.color_temp] | number |
Kelvin (LB120:2700-6500 LB130:2500-9000) | |
[options.ignore_default] | boolean |
true |
|
[sendOptions] | SendOptions |
Kind: instance property of Bulb
- .schedule
- .getNextAction([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getNextAction([sendOptions]) ⇒
Gets Next Schedule Rule Action.
Requests schedule.get_next_action
.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rules.
Requests schedule.get_rules
.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rule.
Requests schedule.get_rules
and return rule matching Id
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response of rule
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Adds Schedule rule.
Sends schedule.add_rule
command and returns rule id.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.lightState | Object |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Schedule rule.
Sends schedule.edit_rule
command and returns rule id.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options.id | string |
||
options.lightState | Object |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
[description] | |
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Deletes All Schedule Rules.
Sends schedule.delete_all_rules
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Deletes Schedule Rule.
Sends schedule.delete_rule
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Enables or Disables Schedule Rules.
Sends schedule.set_overall_enable
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
enable | boolean |
[sendOptions] | SendOptions |
Get Daily Usage Statisics.
Sends schedule.get_daystat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Usage Statisics.
Sends schedule.get_monthstat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Usage Statistics.
Sends schedule.erase_runtime_stat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Kind: instance property of Bulb
- .time
- .getTime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTimezone([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTime([sendOptions]) ⇒
Gets device's time.
Requests timesetting.get_time
.
Kind: instance method of time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets device's timezone.
Requests timesetting.get_timezone
.
Kind: instance method of time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Returns cached results from last retrieval of system.sys_info
.
Kind: instance property of Bulb
Overrides: sysInfo
Returns: Object
- system.sys_info
Cached value of sys_info.is_dimmable === 1
Kind: instance property of Bulb
Cached value of sys_info.is_color === 1
Kind: instance property of Bulb
Cached value of sys_info.is_variable_color_temp === 1
Kind: instance property of Bulb
Returns array with min and max supported color temperatures
Kind: instance property of Bulb
Returns: Object
- range
Cached value of sys_info.alias
.
Kind: instance property of Bulb
Cached value of sys_info.deviceId
.
Kind: instance property of Bulb
Cached value of sys_info.[description|dev_name]
.
Kind: instance property of Bulb
Cached value of sys_info.model
.
Kind: instance property of Bulb
Cached value of sys_info.alias
.
Kind: instance property of Bulb
Cached value of sys_info.[type|mic_type]
.
Kind: instance property of Bulb
Type of device (or device
if unknown).
Based on cached value of sys_info.[type|mic_type]
Kind: instance property of Bulb
Returns: string
- 'plub'|'bulb'|'device'
Cached value of sys_info.sw_ver
.
Kind: instance property of Bulb
Cached value of sys_info.hw_ver
.
Kind: instance property of Bulb
Cached value of sys_info.[mac|mic_mac|ethernet_mac]
.
Kind: instance property of Bulb
Normalized cached value of sys_info.[mac|mic_mac|ethernet_mac]
Removes all non alphanumeric characters and makes uppercase
aa:bb:cc:00:11:22
will be normalized to AABBCC001122
Kind: instance property of Bulb
Requests common Bulb status details in a single request.
system.get_sysinfo
cloud.get_sysinfo
emeter.get_realtime
schedule.get_next_action
Kind: instance method of Bulb
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets on/off state of Bulb.
Requests lightingservice.get_light_state
and returns true if on_off === 1
.
Kind: instance method of Bulb
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets on/off state of Bulb.
Sends lightingservice.transition_light_state
command with on_off value
.
Kind: instance method of Bulb
Param | Type | Description |
---|---|---|
value | boolean |
true: on, false: off |
[sendOptions] | SendOptions |
Toggles state of Bulb.
Requests lightingservice.get_light_state
sets the power state to the opposite of on_off === 1
and returns the new power state.
Kind: instance method of Bulb
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sends payload
to device (using send)
Kind: instance method of Bulb
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type |
---|---|
payload | Object | string |
[sendOptions] | SendOptions |
Sends command(s) to device.
Calls #send and processes the response.
- If only one operation was sent:
- Promise fulfills with specific parsed JSON response for command.
Example:{system:{get_sysinfo:{}}}
- resolves to:
{err_code:0,...}
\ - instead of:
{system:{get_sysinfo:{err_code:0,...}}}
(as #send would)
- resolves to:
- Promise fulfills with specific parsed JSON response for command.
- If more than one operation was sent:
- Promise fulfills with full parsed JSON response (same as #send)
Also, the response's err_code
(s) are checked, if any are missing or != 0
the Promise is rejected with ResponseError.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
command | Object | string |
[sendOptions] | SendOptions |
Polls the device every interval
.
Returns this
(for chaining) that emits events based on state changes.
Refer to specific device sections for event details.
Kind: instance method of Bulb
Returns: Device
| Bulb
| Plug
- this
Param | Type | Description |
---|---|---|
interval | number |
(ms) |
Stops device polling.
Kind: instance method of Bulb
Gets device's SysInfo.
Requests system.sys_info
from device.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Change device's alias (name).
Sends system.set_dev_alias
command.
Kind: instance method of Bulb
Param | Type |
---|---|
alias | string |
[sendOptions] | SendOptions |
Set device's location.
Sends system.set_dev_location
command.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
latitude | number |
longitude | number |
[sendOptions] | SendOptions |
Gets device's model.
Requests system.sys_info
and returns model name.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Reboot device.
Sends system.reboot
command.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Reset device.
Sends system.reset
command.
Kind: instance method of Bulb
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Bulb's Energy Monitoring Details were updated from device. Fired regardless if status was changed.
Kind: event emitted by Bulb
Properties
Name | Type | Description |
---|---|---|
value | Object |
emeterRealtime |
Bulb was turned on (lightstate.on_off
).
Kind: event emitted by Bulb
Properties
Name | Type | Description |
---|---|---|
value | Object |
lightstate |
Bulb was turned off (lightstate.on_off
).
Kind: event emitted by Bulb
Properties
Name | Type | Description |
---|---|---|
value | Object |
lightstate |
Bulb's lightstate was changed.
Kind: event emitted by Bulb
Properties
Name | Type | Description |
---|---|---|
value | Object |
lightstate |
Bulb's lightstate state was updated from device. Fired regardless if status was changed.
Kind: event emitted by Bulb
Properties
Name | Type | Description |
---|---|---|
value | Object |
lightstate |
Lighting
Kind: global class
- Lighting
- .lightState ⇒
Object
- .getLightState([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setLightState(options, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .lightState ⇒
Returns cached results from last retrieval of lightingservice.get_light_state
.
Kind: instance property of Lighting
Get Bulb light state.
Requests lightingservice.get_light_state
.
Kind: instance method of Lighting
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets Bulb light state (on/off, brightness, color, etc).
Sends lightingservice.transition_light_state
command.
Kind: instance method of Lighting
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
[options.transition_period] | number |
(ms) | |
[options.on_off] | boolean |
||
[options.mode] | string |
||
[options.hue] | number |
0-360 | |
[options.saturation] | number |
0-100 | |
[options.brightness] | number |
0-100 | |
[options.color_temp] | number |
Kelvin (LB120:2700-6500 LB130:2500-9000) | |
[options.ignore_default] | boolean |
true |
|
[sendOptions] | SendOptions |
BulbSchedule
Kind: global class
- BulbSchedule
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Adds Schedule rule.
Sends schedule.add_rule
command and returns rule id.
Kind: instance method of BulbSchedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.lightState | Object |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Schedule rule.
Sends schedule.edit_rule
command and returns rule id.
Kind: instance method of BulbSchedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options.id | string |
||
options.lightState | Object |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
[description] | |
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Client that sends commands to specified devices or discover devices on the local subnet.
- Contains factory methods to create devices.
- Events are emitted after #startDiscovery is called.
Kind: global class
Extends: EventEmitter
- Client ⇐
EventEmitter
- new Client(options)
- .send(payload, host, [port], [sendOptions]) ⇒
Promise.<Object, Error>
- .getSysInfo(host, [port], [sendOptions]) ⇒
Promise.<Object, Error>
- .getBulb(deviceOptions) ⇒
Bulb
- .getPlug(deviceOptions) ⇒
Plug
- .getDevice(deviceOptions, [sendOptions]) ⇒
Promise.<(Plug|Bulb), Error>
- .getCommonDevice(deviceOptions) ⇒
Device
- .getDeviceFromSysInfo(sysInfo, deviceOptions) ⇒
Plug
|Bulb
- .getTypeFromSysInfo(sysInfo) ⇒
string
- .startDiscovery(options) ⇒
Client
- .stopDiscovery()
- "device-new"
- "device-online"
- "device-offline"
- "bulb-new"
- "bulb-online"
- "bulb-offline"
- "plug-new"
- "plug-online"
- "plug-offline"
- "discovery-invalid"
- "error"
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
[options.defaultSendOptions] | SendOptions |
||
[options.defaultSendOptions.timeout] | Number |
5000 |
(ms) |
[options.defaultSendOptions.transport] | string |
"tcp" |
'tcp' or 'udp' |
[options.logLevel] | string |
level for built in logger ['error','warn','info','debug','trace'] |
Encrypts payload
and sends to device.
- If
payload
is not a string, it isJSON.stringify
'd. - Promise fulfills with parsed JSON response.
Devices use JSON to communicate.
For Example:
- If a device receives:
{"system":{"get_sysinfo":{}}}
- It responds with:
{"system":{"get_sysinfo":{ err_code: 0, sw_ver: "1.0.8 Build 151113 Rel.24658", hw_ver: "1.0", ... }}}
All responses from device contain an err_code
(0
is success).
Kind: instance method of Client
Param | Type | Default |
---|---|---|
payload | Object | string |
|
host | string |
|
[port] | number |
9999 |
[sendOptions] | SendOptions |
Requests {system:{get_sysinfo:{}}}
from device.
Kind: instance method of Client
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type | Default |
---|---|---|
host | string |
|
[port] | number |
9999 |
[sendOptions] | SendOptions |
client.getBulb(deviceOptions) ⇒ Bulb
Creates Bulb object.
See Device#constructor and Bulb#constructor for valid options.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
deviceOptions | Object |
passed to Bulb#constructor |
client.getPlug(deviceOptions) ⇒ Plug
Creates Plug object.
See Device#constructor and Plug#constructor for valid options.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
deviceOptions | Object |
passed to Plug#constructor |
Creates a Plug or Bulb after querying device to determine type.
See Device#constructor, Bulb#constructor, Plug#constructor for valid options.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
deviceOptions | Object |
passed to Device#constructor |
[sendOptions] | SendOptions |
client.getCommonDevice(deviceOptions) ⇒ Device
Create Device object.
- Device object only supports common Device methods.
- See Device#constructor for valid options.
- Instead use #getDevice to create a fully featured object.
Kind: instance method of Client
Param | Type | Description |
---|---|---|
deviceOptions | Object |
passed to Device#constructor |
Creates device corresponding to the provided sysInfo
.
See Device#constructor, Bulb#constructor, Plug#constructor for valid options
Kind: instance method of Client
Param | Type | Description |
---|---|---|
sysInfo | Object |
|
deviceOptions | Object |
passed to device constructor |
Guess the device type from provided sysInfo
.
Based on sys_info.[type|mic_type]
Kind: instance method of Client
Returns: string
- 'plug','bulb','device'
Param | Type |
---|---|
sysInfo | Object |
client.startDiscovery(options) ⇒ Client
Discover TP-Link Smarthome devices on the network.
- Sends a discovery packet (via UDP) to the
broadcast
address everydiscoveryInterval
(ms). - Stops discovery after
discoveryTimeout
(ms) (if0
, runs until #stopDiscovery is called).- If a device does not respond after
offlineTolerance
number of attempts, event:Client#device-offline is emitted.
- If a device does not respond after
- If
deviceTypes
are specified only matching devices are found. - If
macAddresses
are specified only matching device with matching MAC addresses are found. - If
devices
are specified it will attempt to contact them directly in addition to sending to the broadcast address.devices
are specified as an array of[{host, [port: 9999]}]
.
Kind: instance method of Client
Returns: Client
- this
Emits: error
, device-new
, device-online
, device-offline
, bulb-new
, bulb-online
, bulb-offline
, plug-new
, plug-online
, plug-offline
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
[options.address] | string |
address to bind udp socket | |
[options.port] | number |
port to bind udp socket | |
[options.broadcast] | string |
"255.255.255.255" |
broadcast address |
[options.discoveryInterval] | number |
10000 |
(ms) |
[options.discoveryTimeout] | number |
0 |
(ms) |
[options.offlineTolerance] | number |
3 |
# of consecutive missed replies to consider offline |
[options.deviceTypes] | Array.<string> |
'plug','bulb' | |
[options.macAddresses] | Array.<string> |
MAC will be normalized, comparison will be done after removing special characters (: ,- , etc.) and case insensitive |
|
[options.deviceOptions] | Object |
{} |
passed to device constructors |
[options.devices] | Array.<Object> |
known devices to query instead of relying on broadcast |
Stops discovery and closes UDP socket.
Kind: instance method of Client
First response from device.
Kind: event emitted by Client
Properties
Type |
---|
Device | Bulb | Plug |
Follow up response from device.
Kind: event emitted by Client
Properties
Type |
---|
Device | Bulb | Plug |
No response from device.
Kind: event emitted by Client
Properties
Type |
---|
Device | Bulb | Plug |
First response from Bulb.
Kind: event emitted by Client
Properties
Type |
---|
Bulb |
Follow up response from Bulb.
Kind: event emitted by Client
Properties
Type |
---|
Bulb |
No response from Bulb.
Kind: event emitted by Client
Properties
Type |
---|
Bulb |
First response from Plug.
Kind: event emitted by Client
Properties
Type |
---|
Plug |
Follow up response from Plug.
Kind: event emitted by Client
Properties
Type |
---|
Plug |
No response from Plug.
Kind: event emitted by Client
Properties
Type |
---|
Plug |
Invalid/Unknown response from device.
Kind: event emitted by Client
Properties
Name | Type |
---|---|
rinfo | Object |
response | Buffer |
decryptedResponse | Buffer |
Error during discovery.
Kind: event emitted by Client
Properties
Type |
---|
Error |
TP-Link Device.
Shared behavior for Plug and Bulb.
Kind: global class
Extends: EventEmitter
Emits: Device#event:emeter-realtime-update
- Device ⇐
EventEmitter
- new Device(options)
- .sysInfo ⇒
Object
- .alias ⇒
string
- .deviceId ⇒
string
- .description ⇒
string
- .model ⇒
string
- .name ⇒
string
- .type ⇒
string
- .deviceType ⇒
string
- .softwareVersion ⇒
string
- .hardwareVersion ⇒
string
- .mac ⇒
string
- .macNormalized ⇒
string
- .send(payload, [sendOptions]) ⇒
Promise.<Object, Error>
- .sendCommand(command, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .startPolling(interval) ⇒
Device
|Bulb
|Plug
- .stopPolling()
- .getSysInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setAlias(alias, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setLocation(latitude, longitude, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getModel([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reboot(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reset(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
Created by getCommonDevice - Do not instantiate directly
Param | Type | Default |
---|---|---|
options | Object |
|
options.client | Client |
|
options.sysInfo | Object |
|
options.host | string |
|
[options.port] | number |
9999 |
[options.logger] | Object |
|
[options.defaultSendOptions] | SendOptions |
Returns cached results from last retrieval of system.sys_info
.
Kind: instance property of Device
Returns: Object
- system.sys_info
Cached value of sys_info.alias
.
Kind: instance property of Device
Cached value of sys_info.deviceId
.
Kind: instance property of Device
Cached value of sys_info.[description|dev_name]
.
Kind: instance property of Device
Cached value of sys_info.model
.
Kind: instance property of Device
Cached value of sys_info.alias
.
Kind: instance property of Device
Cached value of sys_info.[type|mic_type]
.
Kind: instance property of Device
Type of device (or device
if unknown).
Based on cached value of sys_info.[type|mic_type]
Kind: instance property of Device
Returns: string
- 'plub'|'bulb'|'device'
Cached value of sys_info.sw_ver
.
Kind: instance property of Device
Cached value of sys_info.hw_ver
.
Kind: instance property of Device
Cached value of sys_info.[mac|mic_mac|ethernet_mac]
.
Kind: instance property of Device
Normalized cached value of sys_info.[mac|mic_mac|ethernet_mac]
Removes all non alphanumeric characters and makes uppercase
aa:bb:cc:00:11:22
will be normalized to AABBCC001122
Kind: instance property of Device
Sends payload
to device (using send)
Kind: instance method of Device
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type |
---|---|
payload | Object | string |
[sendOptions] | SendOptions |
Sends command(s) to device.
Calls #send and processes the response.
- If only one operation was sent:
- Promise fulfills with specific parsed JSON response for command.
Example:{system:{get_sysinfo:{}}}
- resolves to:
{err_code:0,...}
\ - instead of:
{system:{get_sysinfo:{err_code:0,...}}}
(as #send would)
- resolves to:
- Promise fulfills with specific parsed JSON response for command.
- If more than one operation was sent:
- Promise fulfills with full parsed JSON response (same as #send)
Also, the response's err_code
(s) are checked, if any are missing or != 0
the Promise is rejected with ResponseError.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
command | Object | string |
[sendOptions] | SendOptions |
Polls the device every interval
.
Returns this
(for chaining) that emits events based on state changes.
Refer to specific device sections for event details.
Kind: instance method of Device
Returns: Device
| Bulb
| Plug
- this
Param | Type | Description |
---|---|---|
interval | number |
(ms) |
Stops device polling.
Kind: instance method of Device
Gets device's SysInfo.
Requests system.sys_info
from device.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Change device's alias (name).
Sends system.set_dev_alias
command.
Kind: instance method of Device
Param | Type |
---|---|
alias | string |
[sendOptions] | SendOptions |
Set device's location.
Sends system.set_dev_location
command.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
latitude | number |
longitude | number |
[sendOptions] | SendOptions |
Gets device's model.
Requests system.sys_info
and returns model name.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Reboot device.
Sends system.reboot
command.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Reset device.
Sends system.reset
command.
Kind: instance method of Device
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Netif
Requests netif.get_scaninfo
(list of WiFi networks).
Note that timeoutInSeconds
is sent in the request and is not the actual network timeout.
The network timeout for the request is calculated by adding the
default network timeout to timeoutInSeconds
.
Kind: instance method of Netif
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
[refresh] | Boolean |
false |
request device's cached results |
[timeoutInSeconds] | number |
10 |
timeout for scan in seconds |
[sendOptions] | SendOptions |
Away
Kind: global class
- Away
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Gets Away Rules.
Requests anti_theft.get_rules
.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Away Rule.
Requests anti_theft.get_rules
and return rule matching Id
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response of rule
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Adds Away Rule.
Sends anti_theft.add_rule
command and returns rule id.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.start | Date | number |
Date or number of minutes | |
options.end | Date | number |
Date or number of minutes (only time component of date is used) | |
options.daysOfWeek | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.frequency] | number |
5 |
|
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Away rule.
Sends anti_theft.edit_rule
command and returns rule id.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
||
options.start | Date | number |
Date or number of minutes | |
options.end | Date | number |
Date or number of minutes (only time component of date is used) | |
options.daysOfWeek | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.frequency] | number |
5 |
|
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Deletes All Away Rules.
Sends anti_theft.delete_all_rules
command.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Deletes Away Rule.
Sends anti_theft.delete_rule
command.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Enables or Disables Away Rules.
Sends anti_theft.set_overall_enable
command.
Kind: instance method of Away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
enable | boolean |
[sendOptions] | SendOptions |
Plug ⇐ Device
Plug Device.
TP-Link models: HS100, HS105, HS110, HS200.
Emits events after device status is queried, such as #getSysInfo and #getEmeterRealtime.
Kind: global class
Extends: Device
, EventEmitter
Emits: power-on
, power-off
, power-update
, in-use
, not-in-use
, in-use-update
, emeter-realtime-update
- Plug ⇐
Device
- new Plug(options)
- .away
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
- .cloud
- .getInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .bind(username, password, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .unbind([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getFirmwareList([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setServerUrl(server, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getInfo([sendOptions]) ⇒
- .emeter
- .realtime ⇒
Object
- .getRealtime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .realtime ⇒
- .schedule
- .getNextAction([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getNextAction([sendOptions]) ⇒
- .time
- .getTime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTimezone([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTime([sendOptions]) ⇒
- .timer
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
- .sysInfo ⇒
Object
- .inUse ⇒
boolean
- .relayState ⇒
boolean
- .alias ⇒
string
- .deviceId ⇒
string
- .description ⇒
string
- .model ⇒
string
- .name ⇒
string
- .type ⇒
string
- .deviceType ⇒
string
- .softwareVersion ⇒
string
- .hardwareVersion ⇒
string
- .mac ⇒
string
- .macNormalized ⇒
string
- .getInfo([sendOptions]) ⇒
Promise.<Object, Error>
- .getInUse([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .getLedState([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setLedState(value, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .getPowerState([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setPowerState(value, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .togglePowerState([sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .blink([times], [rate], [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .send(payload, [sendOptions]) ⇒
Promise.<Object, Error>
- .sendCommand(command, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .startPolling(interval) ⇒
Device
|Bulb
|Plug
- .stopPolling()
- .getSysInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setAlias(alias, [sendOptions]) ⇒
Promise.<boolean, ResponseError>
- .setLocation(latitude, longitude, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getModel([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reboot(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .reset(delay, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- "power-on"
- "power-off"
- "power-update"
- "in-use"
- "not-in-use"
- "in-use-update"
- "emeter-realtime-update"
Created by Client - Do not instantiate directly.
See Device#constructor for common options.
Param | Type | Default |
---|---|---|
options | Object |
|
[options.inUseThreshold] | Number |
0 |
Kind: instance property of Plug
- .away
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Gets Away Rules.
Requests anti_theft.get_rules
.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Adds Away Rule.
Sends anti_theft.add_rule
command and returns rule id.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.start | Date | number |
Date or number of minutes | |
options.end | Date | number |
Date or number of minutes (only time component of date is used) | |
options.daysOfWeek | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.frequency] | number |
5 |
|
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Away rule.
Sends anti_theft.edit_rule
command and returns rule id.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
||
options.start | Date | number |
Date or number of minutes | |
options.end | Date | number |
Date or number of minutes (only time component of date is used) | |
options.daysOfWeek | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.frequency] | number |
5 |
|
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Deletes All Away Rules.
Sends anti_theft.delete_all_rules
command.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Deletes Away Rule.
Sends anti_theft.delete_rule
command.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Enables or Disables Away Rules.
Sends anti_theft.set_overall_enable
command.
Kind: instance method of away
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
enable | boolean |
[sendOptions] | SendOptions |
Kind: instance property of Plug
- .cloud
- .getInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .bind(username, password, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .unbind([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getFirmwareList([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setServerUrl(server, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getInfo([sendOptions]) ⇒
Gets device's TP-Link cloud info.
Requests cloud.get_info
.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Add device to TP-Link cloud.
Sends cloud.bind
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
username | string |
password | string |
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.unbind
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.get_intl_fw_list
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets device's TP-Link cloud server URL.
Sends cloud.set_server_url
command.
Kind: instance method of cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Description |
---|---|---|
server | string |
URL |
[sendOptions] | SendOptions |
Kind: instance property of Plug
- .emeter
- .realtime ⇒
Object
- .getRealtime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .realtime ⇒
Returns cached results from last retrieval of emeter.get_realtime
.
Kind: instance property of emeter
Gets device's current energy stats.
Requests emeter.get_realtime
.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Get Daily Emeter Statisics.
Sends emeter.get_daystat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Emeter Statisics.
Sends emeter.get_monthstat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Emeter Statistics.
Sends emeter.erase_runtime_stat
command.
Kind: instance method of emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Kind: instance property of Plug
- .schedule
- .getNextAction([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getNextAction([sendOptions]) ⇒
Gets Next Schedule Rule Action.
Requests schedule.get_next_action
.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rules.
Requests schedule.get_rules
.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rule.
Requests schedule.get_rules
and return rule matching Id
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response of rule
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Adds Schedule rule.
Sends schedule.add_rule
command and returns rule id.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.powerState | boolean |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Schedule rule.
Sends schedule.edit_rule
command and returns rule id.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
||
options.powerState | boolean |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
[description] | |
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Deletes All Schedule Rules.
Sends schedule.delete_all_rules
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Deletes Schedule Rule.
Sends schedule.delete_rule
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Enables or Disables Schedule Rules.
Sends schedule.set_overall_enable
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
enable | boolean |
[sendOptions] | SendOptions |
Get Daily Usage Statisics.
Sends schedule.get_daystat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Usage Statisics.
Sends schedule.get_monthstat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Usage Statistics.
Sends schedule.erase_runtime_stat
command.
Kind: instance method of schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Kind: instance property of Plug
- .time
- .getTime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTimezone([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTime([sendOptions]) ⇒
Gets device's time.
Requests timesetting.get_time
.
Kind: instance method of time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets device's timezone.
Requests timesetting.get_timezone
.
Kind: instance method of time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Kind: instance property of Plug
- .timer
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Get Countdown Timer Rule (only one allowed).
Requests count_down.get_rules
.
Kind: instance method of timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Add Countdown Timer Rule (only one allowed).
Sends count_down.add_rule command.
Kind: instance method of timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.delay | number |
delay in seconds | |
options.powerState | boolean |
turn on or off device | |
[options.name] | string |
"'timer'" |
rule name |
[options.enable] | boolean |
true |
rule enabled |
[options.deleteExisting] | boolean |
true |
send delete_all_rules command before adding |
[sendOptions] | SendOptions |
Edit Countdown Timer Rule (only one allowed).
Sends count_down.edit_rule command.
Kind: instance method of timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
rule id | |
options.delay | number |
delay in seconds | |
options.powerState | number |
turn on or off device | |
[options.name] | string |
"'timer'" |
rule name |
[options.enable] | Boolean |
true |
rule enabled |
[sendOptions] | SendOptions |
Delete Countdown Timer Rule (only one allowed).
Sends count_down.delete_all_rules command.
Kind: instance method of timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Returns cached results from last retrieval of system.sys_info
.
Kind: instance property of Plug
Overrides: sysInfo
Returns: Object
- system.sys_info
Determines if device is in use based on cached emeter.get_realtime
results.
If device supports energy monitoring (HS110): power > inUseThreshold
Otherwise fallback on relay state: relay_state === 1
Kind: instance property of Plug
sys_info.relay_state === 1
Kind: instance property of Plug
Cached value of sys_info.alias
.
Kind: instance property of Plug
Cached value of sys_info.deviceId
.
Kind: instance property of Plug
Cached value of sys_info.[description|dev_name]
.
Kind: instance property of Plug
Cached value of sys_info.model
.
Kind: instance property of Plug
Cached value of sys_info.alias
.
Kind: instance property of Plug
Cached value of sys_info.[type|mic_type]
.
Kind: instance property of Plug
Type of device (or device
if unknown).
Based on cached value of sys_info.[type|mic_type]
Kind: instance property of Plug
Returns: string
- 'plub'|'bulb'|'device'
Cached value of sys_info.sw_ver
.
Kind: instance property of Plug
Cached value of sys_info.hw_ver
.
Kind: instance property of Plug
Cached value of sys_info.[mac|mic_mac|ethernet_mac]
.
Kind: instance property of Plug
Normalized cached value of sys_info.[mac|mic_mac|ethernet_mac]
Removes all non alphanumeric characters and makes uppercase
aa:bb:cc:00:11:22
will be normalized to AABBCC001122
Kind: instance property of Plug
Requests common Plug status details in a single request.
system.get_sysinfo
cloud.get_sysinfo
emeter.get_realtime
schedule.get_next_action
Kind: instance method of Plug
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Same as #inUse, but requests current emeter.get_realtime
.
Kind: instance method of Plug
Param | Type |
---|---|
[sendOptions] | SendOptions |
Get Plug LED state (night mode).
Requests system.sys_info
and returns true if led_off === 0
.
Kind: instance method of Plug
Returns: Promise.<boolean, ResponseError>
- LED State, true === on
Param | Type |
---|---|
[sendOptions] | SendOptions |
Turn Plug LED on/off (night mode).
Sends system.set_led_off
command.
Kind: instance method of Plug
Param | Type | Description |
---|---|---|
value | boolean |
LED State, true === on |
[sendOptions] | SendOptions |
Get Plug relay state (on/off).
Requests system.get_sysinfo
and returns true if relay_state === 1
.
Kind: instance method of Plug
Param | Type |
---|---|
[sendOptions] | SendOptions |
Turns Plug relay on/off.
Sends system.set_relay_state
command.
Kind: instance method of Plug
Param | Type |
---|---|
value | boolean |
[sendOptions] | SendOptions |
Toggles Plug relay state.
Requests system.get_sysinfo
sets the power state to the opposite relay_state === 1 and return the new power state
.
Kind: instance method of Plug
Param | Type |
---|---|
[sendOptions] | SendOptions |
Blink Plug LED.
Sends system.set_led_off
command alternating on and off number of times
at rate
,
then sets the led to its pre-blink state.
Note: system.set_led_off
is particulally slow, so blink rate is not guaranteed.
Kind: instance method of Plug
Param | Type | Default |
---|---|---|
[times] | number |
5 |
[rate] | number |
1000 |
[sendOptions] | SendOptions |
Sends payload
to device (using send)
Kind: instance method of Plug
Returns: Promise.<Object, Error>
- parsed JSON response
Param | Type |
---|---|
payload | Object | string |
[sendOptions] | SendOptions |
Sends command(s) to device.
Calls #send and processes the response.
- If only one operation was sent:
- Promise fulfills with specific parsed JSON response for command.
Example:{system:{get_sysinfo:{}}}
- resolves to:
{err_code:0,...}
\ - instead of:
{system:{get_sysinfo:{err_code:0,...}}}
(as #send would)
- resolves to:
- Promise fulfills with specific parsed JSON response for command.
- If more than one operation was sent:
- Promise fulfills with full parsed JSON response (same as #send)
Also, the response's err_code
(s) are checked, if any are missing or != 0
the Promise is rejected with ResponseError.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
command | Object | string |
[sendOptions] | SendOptions |
Polls the device every interval
.
Returns this
(for chaining) that emits events based on state changes.
Refer to specific device sections for event details.
Kind: instance method of Plug
Returns: Device
| Bulb
| Plug
- this
Param | Type | Description |
---|---|---|
interval | number |
(ms) |
Stops device polling.
Kind: instance method of Plug
Gets device's SysInfo.
Requests system.sys_info
from device.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Change device's alias (name).
Sends system.set_dev_alias
command.
Kind: instance method of Plug
Param | Type |
---|---|
alias | string |
[sendOptions] | SendOptions |
Set device's location.
Sends system.set_dev_location
command.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
latitude | number |
longitude | number |
[sendOptions] | SendOptions |
Gets device's model.
Requests system.sys_info
and returns model name.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Reboot device.
Sends system.reboot
command.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Reset device.
Sends system.reset
command.
Kind: instance method of Plug
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
delay | number |
[sendOptions] | SendOptions |
Plug's relay was turned on.
Kind: event emitted by Plug
Plug's relay was turned off.
Kind: event emitted by Plug
Plug's relay state was updated from device. Fired regardless if status was changed.
Kind: event emitted by Plug
Properties
Name | Type | Description |
---|---|---|
value | boolean |
Relay State |
Plug's relay was turned on or power draw exceeded inUseThreshold
for HS110
Kind: event emitted by Plug
Plug's relay was turned off or power draw fell below inUseThreshold
for HS110
Kind: event emitted by Plug
Plug's in-use state was updated from device. Fired regardless if status was changed.
Kind: event emitted by Plug
Properties
Name | Type | Description |
---|---|---|
value | boolean |
In Use State |
Plug's Energy Monitoring Details were updated from device. Fired regardless if status was changed.
Kind: event emitted by Plug
Properties
Name | Type | Description |
---|---|---|
value | Object |
emeterRealtime |
PlugSchedule
Kind: global class
- PlugSchedule
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Adds Schedule rule.
Sends schedule.add_rule
command and returns rule id.
Kind: instance method of PlugSchedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.powerState | boolean |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
||
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Edits Schedule rule.
Sends schedule.edit_rule
command and returns rule id.
Kind: instance method of PlugSchedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
||
options.powerState | boolean |
||
options.start | Date | number |
Date or number of minutes | |
[options.daysOfWeek] | Array.<number> |
[0,6] = weekend, [1,2,3,4,5] = weekdays | |
[options.name] | string |
[description] | |
[options.enable] | boolean |
true |
|
[sendOptions] | SendOptions |
Timer
Kind: global class
- Timer
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(options, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Get Countdown Timer Rule (only one allowed).
Requests count_down.get_rules
.
Kind: instance method of Timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Add Countdown Timer Rule (only one allowed).
Sends count_down.add_rule command.
Kind: instance method of Timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.delay | number |
delay in seconds | |
options.powerState | boolean |
turn on or off device | |
[options.name] | string |
"'timer'" |
rule name |
[options.enable] | boolean |
true |
rule enabled |
[options.deleteExisting] | boolean |
true |
send delete_all_rules command before adding |
[sendOptions] | SendOptions |
Edit Countdown Timer Rule (only one allowed).
Sends count_down.edit_rule command.
Kind: instance method of Timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.id | string |
rule id | |
options.delay | number |
delay in seconds | |
options.powerState | number |
turn on or off device | |
[options.name] | string |
"'timer'" |
rule name |
[options.enable] | Boolean |
true |
rule enabled |
[sendOptions] | SendOptions |
Delete Countdown Timer Rule (only one allowed).
Sends count_down.delete_all_rules command.
Kind: instance method of Timer
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Cloud
Kind: global class
- Cloud
- .getInfo([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .bind(username, password, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .unbind([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getFirmwareList([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setServerUrl(server, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getInfo([sendOptions]) ⇒
Gets device's TP-Link cloud info.
Requests cloud.get_info
.
Kind: instance method of Cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Add device to TP-Link cloud.
Sends cloud.bind
command.
Kind: instance method of Cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
username | string |
password | string |
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.unbind
command.
Kind: instance method of Cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Remove device from TP-Link cloud.
Sends cloud.get_intl_fw_list
command.
Kind: instance method of Cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Sets device's TP-Link cloud server URL.
Sends cloud.set_server_url
command.
Kind: instance method of Cloud
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type | Description |
---|---|---|
server | string |
URL |
[sendOptions] | SendOptions |
Eemter
Kind: global class
- Emeter
- .realtime ⇒
Object
- .getRealtime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .realtime ⇒
Returns cached results from last retrieval of emeter.get_realtime
.
Kind: instance property of Emeter
Gets device's current energy stats.
Requests emeter.get_realtime
.
Kind: instance method of Emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Get Daily Emeter Statisics.
Sends emeter.get_daystat
command.
Kind: instance method of Emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Emeter Statisics.
Sends emeter.get_monthstat
command.
Kind: instance method of Emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Emeter Statistics.
Sends emeter.erase_runtime_stat
command.
Kind: instance method of Emeter
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Schedule
Kind: global class
- Schedule
- .getNextAction([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .addRule(rule, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .editRule(rule, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteAllRules([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .deleteRule(id, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .setOverallEnable(enable, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getDayStats(year, month, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getMonthStats(year, [sendOptions]) ⇒
Promise.<Object, ResponseError>
- .eraseStats([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getNextAction([sendOptions]) ⇒
Gets Next Schedule Rule Action.
Requests schedule.get_next_action
.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rules.
Requests schedule.get_rules
.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets Schedule Rule.
Requests schedule.get_rules
and return rule matching Id
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response of rule
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Adds Schedule rule.
Sends schedule.add_rule
command and returns rule id.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
rule | Object |
[sendOptions] | SendOptions |
Edits Schedule Rule.
Sends schedule.edit_rule
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
rule | Object |
[sendOptions] | SendOptions |
Deletes All Schedule Rules.
Sends schedule.delete_all_rules
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Deletes Schedule Rule.
Sends schedule.delete_rule
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
id | string |
[sendOptions] | SendOptions |
Enables or Disables Schedule Rules.
Sends schedule.set_overall_enable
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
enable | boolean |
[sendOptions] | SendOptions |
Get Daily Usage Statisics.
Sends schedule.get_daystat
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
month | number |
[sendOptions] | SendOptions |
Get Monthly Usage Statisics.
Sends schedule.get_monthstat
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
year | number |
[sendOptions] | SendOptions |
Erase Usage Statistics.
Sends schedule.erase_runtime_stat
command.
Kind: instance method of Schedule
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Time
Kind: global class
- Time
- .getTime([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTimezone([sendOptions]) ⇒
Promise.<Object, ResponseError>
- .getTime([sendOptions]) ⇒
Gets device's time.
Requests timesetting.get_time
.
Kind: instance method of Time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Gets device's timezone.
Requests timesetting.get_timezone
.
Kind: instance method of Time
Returns: Promise.<Object, ResponseError>
- parsed JSON response
Param | Type |
---|---|
[sendOptions] | SendOptions |
Represents an error result received from a TP-Link device.
Where response err_code != 0.
Kind: global class
Extends: Error
Send Options.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
timeout | number |
(ms) |
transport | string |
'tcp','udp' |