A REST API to control the TP-Link Smart bulbs that also includes a web interface.
I have also made a standalone app for this which includes tray shortcuts: https://github.com/ToXIc-Dev/tp-link-smart-bulb-app
Here is a screen shot of the web interface, It doesn't look great but it works :)
Uses Konsumer's tplink-lightbulb API
The color picker on the interface was taken from w3schools
Basically mirrors most of the commands from Konsumer's API (Not all commands were added as it didn't seem necessary), This is useful for using it with things like Tasker.
You can then simply run the server.js usingnode server.js
and go to http://localhost:8080 in your browser.
This has been tested using an LB130 but should work for any of the bulbs listed in Konsumer's README.
- scan
Scan for lightbulbs on your network
- power
Set power-state of lightbulb
- info
Get info about the TPLSmartDevice
- cloud
Get cloud info from bulb
- schedule
Get schedule from bulb
Scan for lightbulbs on your network
Add /api?cmd=scan
to the URL
Returns: IP Addresses of found bulbs
Set power-state of lightbulb
Add /api?cmd=power&st=on
and the IP of the bulb with &ip=0.0.0.0
to the URL to turn the bulb on
Add /api?cmd=power&st=off
and the IP of the bulb with &ip=0.0.0.0
to the URL to turn the bulb off
Add /api?cmd=power
and the IP of the bulb with &ip=0.0.0.0
to the URL
Add &ct=COLOUR TEMP HERE IN KELVIN - JUST THE NUMBER
to set the bulb to a specific colour temp OR add &hue=HEX CODE WITHOUT #
to set the bulb to a specific hue
Optional parameters include:
Set the brightness with &bri=NUMBER BETWEEN 1-100
Set the transition period with &trans=NUMBER IN MILLISECONDS
Returns: Bulb State Updated
Get info about the TPLSmartDevice
Add /api?cmd=info
and the IP of the bulb with &ip=0.0.0.0
to the URL
Returns: Bulb info in JSON
Get cloud info from bulb
Add /api?cmd=cinfo
and the IP of the bulb with &ip=0.0.0.0
to the URL
Returns: Bulb cloud info in JSON
Get schedule from bulb
Add /api?cmd=schedule
and the IP of the bulb with &ip=0.0.0.0
to the URL
Returns: Bulb schedule info in JSON