Growcube protocol

GrowcubeProtocol is custom asyncio Protocol for communication with a Growcube device.

class growcube_client.growcubeprotocol.GrowcubeProtocol(on_connected: Callable[[str], None], on_message: Callable[[str], None], on_connection_lost: Callable[[], None])

Bases: Protocol

connection_lost(exc)

Called when the connection is lost or closed.

The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed).

connection_made(transport)

Called when a connection is made.

The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.

data_received(data)

Called when some data is received.

The argument is a bytes object.

send_message(message: bytes) None