pyebus.connection module

EBUS Connection Handling.

class pyebus.connection.Connection(host='127.0.0.1', port=8888, autoconnect=False, timeout=10)[source]

Bases: object

EBUS Connection.

Keyword Arguments:
  • host (str) – Hostname or IP

  • port (int) – Port

  • autoconnect (bool) – Automatically connect and re-connect

  • timeout (int) – Connection Timeout

property host

Host.

property port

Port.

property autoconnect

Automatically connect and re-connect.

property timeout

Connection Timeout.

async async_connect()[source]

Establish connection (required before first communication).

Raises:

ConnectionRefusedError – If connection cannot be established

async async_disconnect()[source]

Disconnect if not already done.

is_connected()[source]

Return True if connection is established.

This does not check if the connection is still usable.

Returns:

bool

async async_write(message)[source]

Send TCP message to EBUSD.

Raises:
async async_request(cmd, *args, **kwargs)[source]

Assemble request starting with cmd and position args and keywords `kwargs’.

Raises:
async async_read(infinite=False, check=True)[source]

Receive lines until an empty one (infinite==False) or infinitly (infinite==True).

Yields:

str – line read

Raises:
async async_readresp(check=True)[source]

Receive command response.

Read one line as command response and one empty line.

Returns:

response

Return type:

str

Raises: