
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
kasa_control
Advanced tools
This will let you use kasa-cloud to hit your TPLink bulbs in nodejs.
If you'd like to hit them directly, on your local network, use tplink-lightbulb. This library is for situations where you want to use a username/password (from tplink cloud.) It will allow you to acces them remotely.
npm i kasa_control
const KasaControl = require('kasa_control')
const kasa = new KasaControl()
const main = async () => {
await kasa.login('email', 'password')
const devices = await kasa.getDevices()
// turn off first device
await kasa.power(devices[0].deviceId, false)
}
main()
PromiseSend a message to a lightbulb (for RAW JS message objects)
PromiseGet a list of devices for your Kasa account
PromiseGet info about a device
PromiseSet power-state of lightbulb
PromiseSend a message to a lightbulb (for RAW JS message objects)
Returns: Promise - Resolves with answer
| Param | Type | Description |
|---|---|---|
| deviceId | string | The deviceId of the device in your kasa app |
| msg | Object | Message to send to bulb |
Example
kasa.send('80126E22B048C76F341BEED1A3EA8E77177F3484', {
'smartlife.iot.smartbulb.lightingservice': {
'transition_light_state': {
'on_off': 1,
'transition_period': 0
}
})
.then(response => {
console.log(response)
})
.catch(e => console.error(e))
PromiseGet a list of devices for your Kasa account
Returns: Promise - Resolves to an array of device-objects
Example
kasa.getDevices()
.then(devices => {
console.log(devices)
})
.catch(e => console.error(e))
PromiseGet info about a device
Returns: Promise - Resolves to an info-pbject about your device
example
kasa.info('80126E22B048C76F341BEED1A3EA8E77177F3484')
.then(info => {
console.log(info)
})
.catch(e => console.error(e))
| Param | Type | Description |
|---|---|---|
| deviceId | string | The deviceId of the device in your kasa app |
PromiseSet power-state of lightbulb
Returns: Promise - Resolves to output of command
| Param | Type | Description |
|---|---|---|
| deviceId | string | The deviceId of the device in your kasa app |
| powerState | Boolean | On or off |
| transition | Number | Transition to new state in this time |
| options | Object | Object containing mode, hue, saturation, color_temp, brightness |
Example
// turn a light on
kasa.power('80126E22B048C76F341BEED1A3EA8E77177F3484', true)
.then(status => {
console.log(status)
})
.catch(err => console.error(err))
Thanks to itnerd for these 3 articles:
FAQs
Use kasa-cloud to hit your TPLink bulbs in nodejs
We found that kasa_control demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.