Welcome to uberbus python library’s documentation!


class uberbus.moodlamp.Moodlamp(address, udp=False)

Class for moodlamps connected to the uberbus.

Create a moodlamp object.

Before issuing any commands to the moodlamp connect() has to be called.

Parameters: address – Hostname or IP address of the node. udp – True for connection less UDP protocol.


Get the color of the lamp.

Return a list with the RGB values of the lamp or False if the command failed.

setcolor(r, g, b)

Set the color of the lamp.

Parameters: r,g,b – The RGB value of the color(0-255 each)

Returns True if the command was successfull.

timedfade(r, g, b, time, allchannelsequal=True)

Fade to a color in a fixed time.

This command fades the moodlamp to the specified RGB value within time seconds.

Parameters: rgb – The RGB value. time – The time in seconds. allchannelsequal – If True all channels will reach their goal at the same time.

If False all channels fade with the same speed with each cannel reaching its goal independently.(Default: True)

Returns True if the command was sucessfull.

class uberbus.ubnode.UBNode(address, port, udp=False)

A base class for uberbus nodes.

This class provides basic TCP and UDP support to communicate with uberbus nodes.

Create a new uberbus node object.

Parameters: address – The hostname or ip address of the node port – The port to connect on the node. This determines the service to be used. udp – If set to True commands will be sent with UDP packets.


Open a connection to the node.

Return value: None

Exceptions: Throws exceptions if the connection failed.


Close the connection to the node.

Return value: None


Listen to messages from the node.

Nodes can send messages which are not in response to commands. To receive theses messages listen() has to be called. Messages can then be read using readRespnse()

Returns noting.


Read the response of the node.

After sending a command with sendCommand() or listening to the node with listen(), responses from the node can be received.

Return values: False if a timeout occoured
The received response if a respnse from the node arrived.

Send a command to the node.

Before using this operation the node has to be connected with connect() The command will be send using the binary uberbus protocol.

Return value: True if the command was sent successfully.


Set the ID of a node

Opens a connection to the management service of the node and tries to set its ID. See the uberbus documentation on the format of an ID.

Return value: True if the command was successfull.

Exceptions: Throws exceptions if no connection
can be opened to the node.

Indices and tables

Table Of Contents

This Page