sbplug

Crates.iosbplug
lib.rssbplug
version0.0.4
sourcesrc
created_at2023-06-26 15:29:13.728651
updated_at2023-07-15 01:02:34.005662
descriptionCLI tool to control SwitchBot Plug.
homepagehttps://github.com/ezotaka/sbplug
repositoryhttps://github.com/ezotaka/sbplug.git
max_upload_size
id900404
size49,080
ezotaka (ezotaka)

documentation

README

sbplug

sbplug is a command line interface (CLI) tool that allows you to control your SwitchBot Plug devices. You can list, turn on/off, and check the status of your devices directly from the command line.

Usage

Before you can use sbplug, you need to set the SwitchBot app token as an environment variable named SWITCHBOT_TOKEN. You can get this token from the SwitchBot app. For details on how to retrieve the token, please refer to the SwitchBot API documentation.

After setting the environment variable, you can use the sbplug command followed by a subcommand. Use the -h/--help flag to print help information.

$ sbplug <SUBCOMMAND>

Available Subcommands

  • help: Prints help information for sbplug or its subcommands.
  • list: Lists all the devices you have.
  • off: Turns off a device.
  • on: Turns on a device.
  • status: Checks the status of a device.

Examples

Here are some examples of how to use sbplug:

  1. List all your devices using the list subcommand:
$ sbplug list

The output will show the device ID, device name, and power status:

1)	AAAAAAAAAAAAAA	Plug-Mini-AAAA	on
2)	BBBBBBBBBBBBBB	Plug-Mini-BBBB	on
  1. Turn on a device with the on subcommand followed by the device ID:
$ sbplug on AAAAAAAAAAAAAA

or

$ sbplug on 1

The output will show success if the operation was successful.

  1. Turn off a device with the off subcommand followed by the device ID:
$ sbplug off BBBBBBBBBBBBBB

Again, the output will show success if the operation was successful.

  1. Check the status of a device with the status subcommand followed by the device ID:
$ sbplug status AAAAAAAAAAAAAA

The output will display detailed information about the device:

DeviceId: AAAAAAAAAAAAAA
DeviceType: Plug Mini (JP)
ElectricCurrent: 0
ElectricityOfDay: 50
HubDeviceId: CCCCCCCCCCCCCC
Power: on
Voltage: 100.3
Weight: 0

Remember, you can use either the device ID or the device's index number from the list subcommand when using the on, off, and status subcommands.

Commit count: 13

cargo fmt