Skip to content
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

RFC: Add discover method to miiocli #343

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion miio/click_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def __init__(self, device_class, name=None, invoke_without_command=False,
self.device_class = device_class
self.device_pass = click.make_pass_decorator(device_class)

attrs.setdefault('params', self.DEFAULT_PARAMS)
# FIXME: Must be made optional for the "discover" command
#attrs.setdefault('params', self.DEFAULT_PARAMS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

attrs.setdefault('callback', click.pass_context(self.group_callback))
if result_callback_pass_device and callable(result_callback):
result_callback = self.device_pass(result_callback)
Expand Down
6 changes: 4 additions & 2 deletions miio/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ def do_discover(self) -> Message:

return m

@staticmethod
def discover(addr: str=None) -> Any:
@command(
default_output=format_output("Discovering"),
)
def discover(self, addr: str=None) -> Any:
"""Scan for devices in the network.
This method is used to discover supported devices by sending a
handshake message to the broadcast address on port 54321.
Expand Down