Code Monkey home page Code Monkey logo

tp-link-smart-bulb-rest-api-with-interface's Introduction

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

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

tp-link-smart-bulb-rest-api-with-interface's People

Contributors

samster395 avatar toxicgaming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.