anki_vector.mdns

This contains the VectorMdns class for discovering Vector (without already knowing the IP address) on a LAN (Local Area Network) over mDNS.

mDNS (multicast DNS) is a protocol for sending UDP packets containing a DNS query to all devices on your Local Area Network. If a device knows how to answer the DNS query, it will respond by multicasting a UDP packet containing the relevant DNS records.

Classes

VectorMdns

VectorMdns provides a static method for discovering a Vector on the same LAN as the SDK program and retrieving its IP address.

class anki_vector.mdns.VectorMdns

VectorMdns provides a static method for discovering a Vector on the same LAN as the SDK program and retrieving its IP address.

static find_vector(name, timeout=5)
Parameters
  • name (str) – A name like “Vector-A1B2”. If None, will search for any Vector.

  • timeout – The discovery will timeout in timeout seconds. Default value is 5.

Returns

dict or None – if Vector found, dict contains keys “name” and “ipv4”

import anki_vector
vector_mdns = anki_vector.mdns.VectorMdns.find_vector("Vector-A1B2")

if vector_mdns is not None:
  print(vector_mdns['ipv4'])
else:
  print("No Vector found on your local network!")