{"id":16188289,"url":"https://github.com/konsumer/tplink-lightbulb","last_synced_at":"2025-04-06T00:08:30.417Z","repository":{"id":41485152,"uuid":"78311840","full_name":"konsumer/tplink-lightbulb","owner":"konsumer","description":"Control TP-Link smart lightbulbs from nodejs","archived":false,"fork":false,"pushed_at":"2023-12-20T20:35:45.000Z","size":1455,"stargazers_count":190,"open_issues_count":8,"forks_count":32,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-10-19T21:46:27.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/konsumer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"konsumer"}},"created_at":"2017-01-08T00:16:59.000Z","updated_at":"2024-09-03T18:36:39.000Z","dependencies_parsed_at":"2024-06-19T01:05:33.551Z","dependency_job_id":"bf3e69a2-3189-4f52-b593-1f70ee20690b","html_url":"https://github.com/konsumer/tplink-lightbulb","commit_stats":{"total_commits":211,"total_committers":11,"mean_commits":"19.181818181818183","dds":0.09004739336492895,"last_synced_commit":"84a4cbc9b69795152f172f75d6ae3f8fee87071d"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Ftplink-lightbulb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Ftplink-lightbulb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Ftplink-lightbulb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Ftplink-lightbulb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/konsumer","download_url":"https://codeload.github.com/konsumer/tplink-lightbulb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415967,"owners_count":20935387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T07:25:49.436Z","updated_at":"2025-04-06T00:08:30.398Z","avatar_url":"https://github.com/konsumer.png","language":"JavaScript","funding_links":["https://github.com/sponsors/konsumer"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://officedepot.scene7.com/is/image/officedepot/945143_p_lb120_pkg?$OD%2DLarge$\u0026wid=450\u0026hei=450\" align=\"right\" alt=\"tested with LB120\" /\u003e\n\n# tplink-lightbulb\n\nControl TP-Link smart-home devices from nodejs\n\n[![NPM](https://badge.fury.io/js/tplink-lightbulb.svg)](https://nodei.co/npm/tplink-lightbulb/)\n\nThis will allow you to control TP-Link smart-home devices from nodejs or the command-line.\n\n## related\n\n* If you want to use kasa (allows you to hit your tplink devices, on an external network) have a look at [kasa_control](https://github.com/konsumer/kasa_control).\n* If you'd like to run a GraphQL server to control your lights, see [tplink-graphql](https://github.com/konsumer/tplink-graphql).\n* If you like to see a demo web-app that uses react \u0026 websockets, see [tpserver](https://github.com/konsumer/tpserver).\n\n## supported devices\n\nNot all TP-Link smart-home devices can do all things, here's the support-matrix:\n\n|                                                                                                             | raw | details | on | off | temp | hex | hsb | cloud | wifi | join |\n|------------------------------------------------------------------------------------------------------------:|:---:|:-------:|:--:|:---:|:----:|:---:|:---:|:-----:|:----:|:----:|\n| [LB100](http://www.tp-link.com/us/products/details/cat-5609_LB100.html)                                     |  X  |    X    |  X |  X  |   X  |     |     |   X   |   X  |   X  |\n| [LB120](http://www.tp-link.com/us/products/details/cat-5609_LB120.html)                                     |  X  |    X    |  X |  X  |   X  |     |     |   X   |   X  |   X  |\n| [LB130](http://www.tp-link.com/us/products/details/cat-5609_LB130.html)                                     |  X  |    X    |  X |  X  |   X  |  X  |  X  |   X   |   X  |   X  |\n| [HS100](http://www.tp-link.com/us/products/details/cat-5516_HS100.html)                                     |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [HS105](http://www.tp-link.com/us/products/details/cat-5516_HS105.html)                                     |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [HS110](http://www.tp-link.com/us/products/details/cat-5516_HS110.html)                                     |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [HS200](http://www.tp-link.com/us/products/details/cat-5622_HS200.html)                                     |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [KP100](http://www.tp-link.com/us/products/details/cat-5516_KP100.html)                                     |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [LB200](http://www.tp-link.com/us/products/details/cat-5609_LB200.html)                                     |  X  |    X    |  X |  X  |   X  |     |     |   X   |   X  |   X  |\n| [LB230](http://www.tp-link.com/us/products/details/cat-5609_LB230.html)                                     |  X  |    X    |  X |  X  |   X  |  X  |  X  |   X   |   X  |   X  |\n| [KL110](https://www.tp-link.com/uk/home-networking/smart-bulb/kl110/)                                       |  X  |    X    |  X |  X  |      |     |     |       |   X  |   X  |\n| [KL120](https://www.tp-link.com/uk/home-networking/smart-bulb/kl120/)                                       |  X  |    X    |  X |  X  |   X  |     |     |   X   |   X  |   X  |\n| [KL130](https://www.kasasmart.com/us/products/smart-lighting/kasa-smart-wi-fi-light-bulb-multicolor-kl130/) |  X  |    X    |  X |  X  |   X  |  X  |  X  |   X   |   X  |   X  |\n\nI have LB120, LB130, and HS105, so any testing (and packet-capture) with other devices would be greatly appreciated. \n\n\n## command-line\n\nIf you have nodejs installed, you can install it for your system with this:\n\n```\nnpm i -g tplink-lightbulb\n```\n\nYou can even run it without installing:\n\n```\nnpx tplink-lightbulb\n```\n\nIf you don't want to install nodejs, or just want the standalone-version, install a [release](https://github.com/konsumer/tplink-lightbulb/releases) for your system.\n\nNow, you can use it like this:\n\n```\nUsage: tplight \u003cCOMMAND\u003e\n\nCommands:\n  tplight scan                               Scan for lightbulbs\n  tplight on \u003cip\u003e                            Turn on lightbulb\n  tplight off \u003cip\u003e                           Turn off lightbulb\n  tplight bright \u003cip\u003e \u003cbrightness\u003e           Set the brightness of the lightbulb\n                                            (for those that support it)\n  tplight temp \u003cip\u003e \u003ccolor\u003e                  Set the color-temperature of the\n                                            lightbulb (for those that support\n                                            it)\n  tplight hex \u003cip\u003e \u003ccolor\u003e                   Set color of lightbulb using hex\n                                            color (for those that support it)\n  tplight hsb \u003cip\u003e \u003chue\u003e \u003csaturation\u003e        Set color of lightbulb using HSB\n  \u003cbrightness\u003e                              color (for those that support it)\n  tplight cloud \u003cip\u003e                         Get cloud info\n  tplight raw \u003cip\u003e \u003cjson\u003e                    Send a raw JSON command\n  tplight details \u003cip\u003e                       Get details about the device\n  tplight led \u003cip\u003e \u003cledState\u003e                Turn on/off LED indicator\n  tplight wifi \u003cip\u003e                          List available wifi for a particular\n                                            device\n  tplight join \u003cip\u003e \u003cSSID\u003e [SECRET]          Configure the device to use these\n                                            wifi settings\n\nOptions:\n  -h, --help     Show help                                             [boolean]\n      --version  Show version number                                   [boolean]\n\nExamples:\n  tplight scan -h     Get more detailed help with `scan` command\n  tplight on -h       Get more detailed help with `on` command\n  tplight off -h      Get more detailed help with `off` command\n  tplight temp -h     Get more detailed help with `temp` command\n  tplight hex -h      Get more detailed help with `hex` command\n  tplight hsb -h      Get more detailed help with `hsb` command\n  tplight cloud -h    Get more detailed help with `cloud` command\n  tplight raw -h      Get more detailed help with `raw` command\n  tplight details -h  Get more detailed help with `details` command\n  tplight led -h      Get more detailed help with `led` command\n  tplight wifi -h     Get more detailed help with `wifi` command\n  tplight join -h     Get more detailed help with `join` command\n```\n\n## wireshark\n\nIf you want to analyze the protocol, you can use the included `tplink-smarthome.lua`.\n\nInstall in the location listed in About Wireshark/Folders/Personal Plugins\n\nI captured packets with tcpdump running on a [raspberry pi pretending to be a router](https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point?view=all). In general, this is a really useful way to capture IOT protocols and mess around with them.\n\nI ssh'd into my pi, ran `sudo apt update \u0026\u0026 sudo apt install tcpdump`, then `tcpdump -i wlan0 -w lights.pcap`\n\nI connected the lights to that network (reset them to factory default by turning the power off/on 5 times, then configure in Kasa app.)\n\nAfter I did stuff like switch the lights on/off in app, I open the pcap file in wireshark on my desktop.\n\n## library\n\nYou can install it in your project like this:\n\n```\nnpm i -S tplink-lightbulb\n```\n\nInclude it in your project like this:\n\n```js\nconst TPLSmartDevice = require('tplink-lightbulb')\n```\n\nor for ES6:\n\n```js\nimport TPLSmartDevice from 'tplink-lightbulb'\n```\n\nRead more about [the API](https://github.com/konsumer/tplink-lightbulb/blob/master/API.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Ftplink-lightbulb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonsumer%2Ftplink-lightbulb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Ftplink-lightbulb/lists"}