Basic controls for TP-Link light bulbs over HTTP
The communication is handled using the tplink-lightbulb library.
This allows for the following actions:
- Light on
- GET
- /light/on
- Light off
- GET
- /light/off
- Light brightness to 100
- GET
- /light/brightness/100
- Light brightness to 50
- GET
- /light/brightness/50
- Light details
- GET
- /light/details
- Display on
- GET
- /display/on
- Display off
- GET
- /display/off
Run the following to install express and tplink-lightbulb dependencies:
npm installThere are values of variables that you may need to adjust (especially the IP address of the lightbulb).
| Variable | Description |
|---|---|
| hostname | IP address of TP-Link light bulb |
| port | Port number of the HTTP server that the script would be hosting |
| writeToFile | Output last action status to file |
| statusFile | Path to last action status file -- intended to use with SSD1306-Display-SysInfo to display the status on a display |
| displayOffFile | Path to display off file -- intended to use with SSD1306-Display-SysInfo to control the display visibility |