1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-21 22:51:41 +01:00
python-broadlink/cli
Ian Munsie 634370d878
Add ability to RF scan a specific frequency (#613)
* Add ability to RF scan a specific frequency

This adds an optional parameter to find_rf_packet(), along with a
corresponding --rflearn parameter (defaulting to 433.92) to
broadlink_cli that specifies the frequency to tune to, rather than
requiring the frequency be found via sweeping. This is almost mandatory
for certain types of remotes that do not repeat their signals while the
button is held, and saves significant time when the frequency is known
in advance or when many buttons are to be captured in a row.

Additionally:

- A get_frequency() API is added to return the current frequency the
  device is tuned to.

- A check_frequency_ex() API is added to perform functions of both
  check_frequency() and get_frequency() in a single call.

- broadlink_cli --rfscanlearn will now report the current frequency at 1
  second intervals during sweeping, and will report the frequency it
  finally locks on to.

* Clean up remote.py

* Clean up broadlink_cli

* Update conditional

* Fix message

---------

Co-authored-by: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com>
2024-04-09 15:40:00 -03:00
..
broadlink_cli Add ability to RF scan a specific frequency (#613) 2024-04-09 15:40:00 -03:00
broadlink_discovery Move constants to const.py (#584) 2021-04-29 18:59:58 -03:00
README.md Improve the CLI (#555) 2021-04-26 17:57:01 -03:00

Command line interface for python-broadlink

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

Requirements

You need to install the module first:

pip3 install broadlink

Installation

Download "broadlink_cli" and "broadlink_discovery".

Programs

  • broadlink_discovery: Discover Broadlink devices connected to the local network.

  • broadlink_cli: Send commands and query the Broadlink device.

Device specification formats

Using separate parameters for each information:

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

Using all parameters as a single argument:

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

Using file with parameters:

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

Common commands

Join device to the Wi-Fi network

broadlink_cli --joinwifi SSID PASSWORD

Discover devices connected to the local network

broadlink_discovery

Universal remotes

Learn IR code and show at console

broadlink_cli --device @BEDROOM.device --learn 

Learn RF code and show at console

broadlink_cli --device @BEDROOM.device --rfscanlearn

Learn IR code and save to file

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

Send code

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

Send code from file

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

Check temperature

broadlink_cli --device @BEDROOM.device --temperature

Check humidity

broadlink_cli --device @BEDROOM.device --temperature

Smart plugs

Turn on

broadlink_cli --device @BEDROOM.device --turnon

Turn off

broadlink_cli --device @BEDROOM.device --turnoff

Turn on nightlight

broadlink_cli --device @BEDROOM.device --turnnlon

Turn off nightlight

broadlink_cli --device @BEDROOM.device --turnnloff

Check power state

broadlink_cli --device @BEDROOM.device --check

Check nightlight state

broadlink_cli --device @BEDROOM.device --checknl

Check power consumption

broadlink_cli --device @BEDROOM.device --energy