2020-06-30 00:29:52 +00:00
Command-line usage
==================
2022-10-18 17:08:10 +00:00
The package is shipped with a console tool named `` kasa `` , refer to `` kasa --help `` for detailed usage.
2020-12-09 09:13:14 +00:00
The device to which the commands are sent is chosen by `` KASA_HOST `` environment variable or passing `` --host <address> `` as an option.
2020-06-30 00:29:52 +00:00
To see what is being sent to and received from the device, specify option `` --debug `` .
2022-10-18 21:37:54 +00:00
To avoid discovering the devices when executing commands its type can be passed as an option (e.g., `` --type plug `` for plugs, `` --type bulb `` for bulbs, ..).
2020-12-09 09:13:14 +00:00
If no type is manually given, its type will be discovered automatically which causes a short delay.
2020-06-30 00:29:52 +00:00
If no command is given, the `` state `` command will be executed to query the device state.
2020-12-09 09:13:14 +00:00
.. note ::
Some commands (such as reading energy meter values, changing bulb settings, or accessing individual sockets on smart strips) additional parameters are required,
2022-10-18 21:37:54 +00:00
which you can find by adding `` --help `` after the command, e.g. `` kasa --type emeter --help `` or `` kasa --type hsv --help `` .
2020-12-09 09:13:14 +00:00
Refer to the device type specific documentation for more details.
2023-08-14 12:32:24 +00:00
Discovery
***** *** *
The tool can automatically discover supported devices using a broadcast-based discovery protocol.
This works by sending an UDP datagram on port 9999 to the broadcast address (defaulting to `` 255.255.255.255 `` ).
On multihomed systems, you can use `` --target `` option to specify the broadcsat target.
For example, if your devices reside in network `` 10.0.0.0/24 `` you can use `` kasa --target 10.0.0.255 discover `` to discover them.
.. note ::
When no command is specified when invoking `` kasa `` , a discovery is performed and the `` state `` command is executed on each discovered device.
2020-12-09 09:13:14 +00:00
2020-06-30 00:29:52 +00:00
Provisioning
2020-12-09 09:13:14 +00:00
***** ***** **
2020-06-30 00:29:52 +00:00
You can provision your device without any extra apps by using the `` kasa wifi `` command:
1. If the device is unprovisioned, connect to its open network
2021-12-08 14:32:57 +00:00
2. Use `` kasa discover `` (or check the routes) to locate the IP address of the device (likely 192.168.0.1, if unprovisioned)
3. Scan for available networks using `` kasa --host 192.168.0.1 wifi scan `` see which networks are visible to the device
4. Join/change the network using `` kasa --host 192.168.0.1 wifi join <network to join> ``
As with all other commands, you can also pass `` --help `` to both `` join `` and `` scan `` commands to see the available options.
2020-06-30 00:29:52 +00:00
`` kasa --help ``
2020-12-09 09:13:14 +00:00
***** ***** *****
2020-06-30 00:29:52 +00:00
.. program-output :: kasa --help