LEGO Wireless Protocol v3 device


This is an experimental class. It has not been well tested and may be changed in future.

class LWP3Device(hub_kind, name=None, timeout=10000)

Connects to a hub running official LEGO firmware using the LEGO Wireless Protocol v3

  • hub_kind (int) – The hub type identifier of the hub to connect to.

  • name (str) – The name of the hub to connect to or None to connect to any hub.

  • timeout (int) – The time, in milliseconds, to wait for a connection before raising an exception.

name() str

Sets or gets the Bluetooth name of the device.


name (str) – New Bluetooth name of the device. If no name is given, this method returns the current name.


Sends a message to the remote hub.


buf (bytes) – The raw binary message to send.

read() bytes

Retrieves the most recent message received from the remote hub.

If a message has not been received since the last read, the method will block until a message is received.


The raw binary message.


Disconnects the remote LWP3Device from the hub.