Skip to content

Fix/broadlink cli refactor #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 52 additions & 40 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -1,138 +1,150 @@
Command line interface for python-broadlink
===========================================
# Command line interface for python-broadlink

This is a command line interface for the python-broadlink API.

## Requirements

Requirements
------------
You need to install the module first:
```

```shell
pip3 install broadlink
```

Installation
-----------
Download "broadlink_cli" and "broadlink_discovery".

broadlink_cli should then be in your path

Programs
--------
* broadlink_discovery: Discover Broadlink devices connected to the local network.
## Programs

* broadlink_cli: Send commands and query the Broadlink device.


Device specification formats
----------------------------
## Device specification formats

Using separate parameters for each information:
```

```shell
broadlink_cli --type 0x2712 --host 1.1.1.1 --mac aaaaaaaaaa --temp
```

Using all parameters as a single argument:
```

```shell
broadlink_cli --device "0x2712 1.1.1.1 aaaaaaaaaa" --temp
```

Using file with parameters:
```

```shell
broadlink_cli --device @BEDROOM.device --temp
```

This is prefered as the configuration is stored in a file and you can change
it later to point to a different device.

Example usage
-------------
## Example usage

### Common commands

#### Join device to the Wi-Fi network
```

```shell
broadlink_cli --joinwifi SSID PASSWORD
```

#### Discover devices connected to the local network
```

```shell
broadlink_discovery
```

### Universal remotes

#### Learn IR code and show at console
```
broadlink_cli --device @BEDROOM.device --learn

```shell
broadlink_cli --device @BEDROOM.device --irlearn
```

#### Learn RF code and show at console
```
broadlink_cli --device @BEDROOM.device --rfscanlearn

```shell
broadlink_cli --device @BEDROOM.device --rflearn
```

#### Learn IR code and save to file
```

```shell
broadlink_cli --device @BEDROOM.device --learnfile LG-TV.power
```

#### Learn RF code and save to file
```
broadlink_cli --device @BEDROOM.device --rfscanlearn --learnfile LG-TV.power

```shell
broadlink_cli --device @BEDROOM.device --rflearn --learnfile LG-TV.power
```

#### Send code
```

```shell
broadlink_cli --device @BEDROOM.device --send DATA
```

#### Send code from file
```

```shell
broadlink_cli --device @BEDROOM.device --send @LG-TV.power
```

#### Check temperature
```

```shell
broadlink_cli --device @BEDROOM.device --temperature
```

#### Check humidity
```

```shell
broadlink_cli --device @BEDROOM.device --humidity
```

### Smart plugs

#### Turn on
```

```shell
broadlink_cli --device @BEDROOM.device --turnon
```

#### Turn off
```

```shell
broadlink_cli --device @BEDROOM.device --turnoff
```

#### Turn on nightlight
```

```shell
broadlink_cli --device @BEDROOM.device --turnnlon
```

#### Turn off nightlight
```

```shell
broadlink_cli --device @BEDROOM.device --turnnloff
```

#### Check power state
```

```shell
broadlink_cli --device @BEDROOM.device --check
```

#### Check nightlight state
```

```shell
broadlink_cli --device @BEDROOM.device --checknl
```

#### Check power consumption
```

```shell
broadlink_cli --device @BEDROOM.device --energy
```
Loading