-
-
Notifications
You must be signed in to change notification settings - Fork 598
Obtain token for given IP address #263
Copy link
Copy link
Closed
Description
As far as I see there is no command line option to obtain the token for a device with a specific IP address by just sending the special UDP package (21310020ff...) to port 54321 and extract the token.
Here are some hacky lines to extend the discover option, which should do the job but are not good enough for a pull request 😉:
@cli.command()
@click.option('--handshake', type=bool, default=False)
+ @click.option('--ip', envvar="MIROBO_IP", callback=validate_ip)
def discover(handshake, ip):
"""Search for robots in the network."""
+ if ip:
+ vac = miio.Vacuum(ip)
+ m = vac.do_discover()
+ import binascii
+ import codecs
+ _LOGGER.info(" IP %s (ID: %s) - token: %s",
+ ip,
+ binascii.hexlify(m.header.value.device_id).decode(),
+ codecs.encode(m.checksum, 'hex'))
+ return
if handshake:
miio.Vacuum.discover()
else:
miio.Discovery.discover_mdns()P. S.: Thanks for your project.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels