Skip to content

Commit

Permalink
Expose flow_control paramater from zigpy
Browse files Browse the repository at this point in the history
Certain boards (such as the Sonoff Zigbee 3.0 USB Dongle Plus P) have a
hardware switch that allows for turning on hardware flow control (given
the correct firmware is flashed). This requires of course that zigpy-cli
also allows for setting this flag to be able to communicate with the
dongle.

Zigpy and zigpy-znp already support hardware flow control fully. No wit
is time that zigpy-cli also offers this option.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
  • Loading branch information
oliv3r committed Aug 16, 2024
1 parent e13497f commit 0c2c22d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ radio requires exclusive access to the hardware: if both are running at once, ne
Network commands require the radio type to be specified. See `zigpy radio --help` for the list of supported types.
If your radio requires a different baudrate than the radio library default (mainly EZSP), you must specify it as a command line option. For example, `zigpy radio --baudrate 115200 ezsp backup -`.

Similarly if a different flow control is required ("hardware" for rtscts or "software" for xonxoff), this also must be specified, otherwise the driver default will be used (usually software flow control). For example, `zigpy radio --flow-control hardware znp backup -`.

## Network backup

```console
Expand Down
6 changes: 5 additions & 1 deletion zigpy_cli/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
@click.argument("radio", type=click.Choice(list(RADIO_TO_PACKAGE.keys())))
@click.argument("port", type=str)
@click.option("--baudrate", type=int, default=None)
@click.option("--flow-control", type=click.Choice(["software", "hardware", "none"]), default="none")
@click.option("--database", type=str, default=None)
@click_coroutine
async def radio(ctx, radio, port, baudrate=None, database=None):
async def radio(ctx, radio, port, baudrate=None, flow_control=None, database=None):
# Setup logging for the radio
verbose = ctx.parent.params["verbose"]
logging_configs = RADIO_LOGGING_CONFIGS[radio]
Expand Down Expand Up @@ -60,6 +61,9 @@ async def radio(ctx, radio, port, baudrate=None, database=None):
if baudrate is not None:
config["device"]["baudrate"] = baudrate

if flow_control is not None:
config["device"]["flow_control"] = flow_control

app = radio_module.ControllerApplication(config)

ctx.obj = app
Expand Down

0 comments on commit 0c2c22d

Please sign in to comment.