node-red-contrib-tplink
TP-Link Smart Home Node-Red Nodes




This is a collection of Node-RED nodes that allow you control smart plugs and bulbs from the TP-Link smart home ecosystem.
This is a fork of so inspiring node-red-contrib-tplink-smarthome
with added functionality.
Under the hood, each node uses the awesome TP-Link Smart Home API.
Installation
Run the following command in the root directory of your Node-RED install
$ npm install node-red-contrib-tplink
or you can use the Palette Manager in Node-RED.
Parameters
Name
- Type in the name of the host manually or keep the default device name
Device IP
- Type in the Device IP address manually or press the button to retrieve all locally available plug devices
Poll interval
- Interval that is used to poll availability of devices (>500ms / Recommended 5000-10000ms)
Event poll interval
- Interval that is used to poll active devices for events (>500ms / Recommended 1000-3000ms)
Payload
- The output payload. Types are info
, none
, string
, number
, boolean
, JSON
, and timestamp
. Default type is info
with a value of getInfo
. If set to info
, the selected payload command will be fired after completion, and the payload set accordingly. Payload is ignored if the node input is a command or an event.
Debug
- If enabled, will output device information to the flow editor debug tab.
Inputs
payload: Object | string | boolean | array
On/Off
{
"state": true
}
true
- Turn on the device.
false
- Turn off the device.
toggle
- Toggle opposite power state of the device.
switch
- Toggle opposite power state of the device. (deprecated)
Multi-Plug On/Off
{
"plug": 1
"state": true
}
Brightness
{
"brightness": [value 1-100]
}
LED Status Light
{
"led": true
}
Temperature
temperature:[value 2700-6500]
Example: Send payload as temperature:5000
to set temperature of the bulb to 5000k.
Color Support for Multicolor Bulbs
Hue, Saturation, and Brightness (HSB) support for multicolor bulbs.
{
"hsb": {
"hue": 240,
"saturation": 15,
"brightness": 100
}
}
Commands
getInfo
- Fetch the device information.
getCloudInfo
- Fetch the device information from the cloud.
getQuickInfo
- Fetch most popular proprieties, such as username, device consumption, mode, lighting state, and many more. Supports multi-plug.
getMeterInfo
- Fetch the current device consumption. Supports multi-plug.
clearEvents
- Unsubscribe events.
eraseStats
- Clear all the meter statistics. Supports multi-plug.
Events
getMeterEvents
- Subscribe to meter information events. Event emits on event polling interval.
getInfoEvents
- Subscribe to information events.
getPowerEvents
- Subscribe to power on/off events. Event emits on device/plug change.
getPowerUpdateEvents
- Subscribe to power on/off events. Event emits on event polling interval.
getInUseEvents
- Subscribe to device usage events. Event emits on device/plug change.
getInUseUpdateEvents
- Subscribe to device usage events. Event emits on event polling interval.
getOnlineEvents
- Subscribe to online/offline events. Event emits on poll interval.
Multiple events can be used as an array via the events
property or string separated by "|"..
{
"events": ["getMeterUpdateEvents", "getPowerEvents"]
}
or
"getMeterUpdateEvents|getPowerEvents"
For developers
This repo. is (mainly) coded on Node 10.3.0 with Node-RED 0.18.7 on Windows 10 Home Build 17134.81.
Runs succesfully in a Raspberry Pi 3 Model B+ on standard Raspbian Stretch's Node 0.10.29 and matching Node-RED.
