What command you use in your scripts depends on the version you downloaded from the store:
Kasa Smart Control Microsoft Store version (This has the UI and Command Line)
The command is KasaCmd (KasaCmd.exe)
To get the latest help Win Key + R and type KasaCmd
Kasa Smart Control - Command Line Microsoft Store version
The command is TPLinkCmd (TPLinkCmd.exe)
To get the latest help Win Key + R and type TPLinkCmd
Replace the KasaCmd in the examples below with the version you are using. KasaCmd and TPLinkCmd are App Aliases, the path to these files is NOT required to be used in scripts.
Login
you must give a login command before executing a command, the credentials are encrypted and cached so for most scripts this is only required once.
KasaCmd -login -username "test@account.com" -password "password"
Logoff
Add the following at the end of the script, this erases the credentials from the cache.
KasaCmd -logoff
Get Device List
This gives a list of the names to use in the commands
KasaCmd -devicelist
Examples
KasaCmd -login -username "test@account.com" -password "password"
KasaCmd -device "PRINTER" -on
KasaCmd -device "PRINTER" -timer -start -h 0 -m 10 -action 0
KasaCmd -device "F650276187687146786A2846F464E627B832CED" -status
Basic Commands
help
full list of commands, press enter to show the advanced commands
-help (full list with advanced commands)
login
log in with the username and password provided
-login -username "test@account.com" -password "password"
login
without the argument prompts for the username and password
-login
device list
get the device list from the TP-Link servers
-devicelist
on
switch a device on
-device "NAME|ID" -on
off
switch a device off
-device "NAME|ID" -off
toggle
toggle a device status on to off or off to on
-device "NAME|ID" -toggle
status
prints the current relay status
1=on 0 =off
-device "NAME|ID" -status
logoff
clears the cached credentials.
-logoff
Advanced Commands
rename
rename a device
-device "NAME|ID" -rename "new name"
strobe
switches the light on/off for number indicated by strobe with a pause of 1000ms
-device "NAME|ID" -strobe {1>} -interval {1000}
brightness
sets the brightness of a bulb
-device "NAME|ID" -brightness {1-100} (use -off for 0)
hue
sets the hue of a bulb
-device "NAME|ID" -hue {0-360}
saturation
sets the saturation of a bulb, higher the number deeper the colour
-device "NAME|ID" -saturation {0-100}
temperature
sets the temperature of a bulb/light strip this is indicated in K (Kelvin)
examples - 2700K warm white, 4000K natural or 6500K daylight
-device "NAME|ID" -temperature {2700-9000}
autotemperature
matches the colour temperature with the light outdoors
0 = off
1 = on
-device "NAME|ID" -autotemperature {0,1}
emeter
displays the energy monitoring data is various formats
-device "NAME|ID" -emeter {summary|csvheader|csv}
timer start
To set the timer add the hours, minutes and seconds, the action at the end of the timer is 1=On, 0=Off
-device "NAME|ID" -timer start -h {0>} -m {0>} -s {0>} -action {1|0}
timer stop
Stop and remove the active timer from the device.
-device "NAME|ID" -timer stop
timer status
Print the hours, minutes and seconds left on the current timer
-device "NAME|ID" -timer status
away (experimental)
-device "NAME|ID" -away {1|0}
-device "NAME|ID" -away status
-device "NAME|ID" -away rule -start {HH:MM|sunset|sunrise} -end {HH:MM|sunset|sunrise} -days 1010101 (SMTWTFS)
-device "NAME|ID" -away rule 247 (sets daily schedule 00:00 to 23:59)
-device "NAME|ID" -away rule evening (sets daily schedule sunset to 23:59)
effect (beta for KL 430)
switch a light strip (KL430) to a preset scene, off to switch it off
-device "NAME|ID" -effect {"lighting effect name"|off} (BETA for KL430)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article