Okay, this was a little long winded but lon.tv covered the basics. Once you get your lights registered it should look like the Kasa app pictures below.
Now, on to the more important stuff like how are we going to interact with the bulb. You can directly access the bulb but we are going to access the bulb through the Kasa Cloud. Using the kasa_control nodejs library we are going to access the Kasa cloud and send commands to adjust our light. This assumes you have downloaded the Kasa app, created your account and registered your bulb. Below is some code to get the ID of your bulb. If your like me and have multiple bulbs registered you may have to search through the output to find the correct bulb.
--Script--
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const KasaControl = require('kasa_control'); | |
const kasa = new KasaControl(); | |
const email = "email; | |
const password = "password"; | |
async function main() { | |
await kasa.login(email, password); | |
const devices = await kasa.getDevices(); | |
console.log(devices); | |
} | |
main(); |
--Script--
The output from our node script should be something similar to:
The "deviceId" is what we are looking for. We can now plug this into our code so we can control our light. Next up we can start building our Touch UI and construct the code to finish off our project.{ fwVer: '1.8.6 Build 180809 Rel.091659',deviceName: 'Smart Wi-Fi LED Bulb with Dimmable Light',status: 1,alias: 'Office',deviceType: 'IOT.SMARTBULB',appServerUrl: 'https://use1-wap.tplinkcloud.com',deviceModel: 'LB100(US)',deviceMac: 'deleted',role: 0,isSameRegion: true,hwId: 'deleted',fwId: '00000000000000000000000000000000',oemId: '264E4E97B2D2B086F289AC1F00B90679',deviceId: '8012221C6DAD0B255555555555555558',deviceHwVer: '1.0' },
VoIPNorm
Exclusive post. Thanks for sharing.
ReplyDeleteWifi Smart LED Bulb