Skip to content

A REST API to control the TP-Link Smart bulbs that also includes a web interface.

Notifications You must be signed in to change notification settings

samster395/TP-Link-Smart-Bulb-REST-API-With-Interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TP-Link-Smart-Bulb-REST-API-With-Interface

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/samster395/tp-link-smart-bulb-app

I have also made a script to comtrol the bulb according to f.lux: https://github.com/samster395/flux-tplink-smart-bulbs

Here is a screen shot of the web interface, It doesn't look great but it works :)

screenshot

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.jsand 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.

Implemented Commands

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

Scan for lightbulbs on your network

Add /api?cmd=scan to the URL

Returns: IP Addresses of found bulbs

power

Set power-state of lightbulb

Turn the bulb on

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

Turn the bulb off

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

Set other state settings

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

info

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

cloud

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

schedule

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

About

A REST API to control the TP-Link Smart bulbs that also includes a web interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published