konashi package

Subpackages

Submodules

konashi.Errors module

exception konashi.Errors.InvalidDeviceError

Bases: Exception

exception konashi.Errors.KonashiConnectionError

Bases: Exception

exception konashi.Errors.KonashiDisabledError

Bases: Exception

exception konashi.Errors.KonashiError

Bases: Exception

exception konashi.Errors.KonashiInvalidError

Bases: Exception

exception konashi.Errors.NotFoundError

Bases: Exception

exception konashi.Errors.PinInvalidError

Bases: Exception

exception konashi.Errors.PinUnavailableError

Bases: Exception

konashi.Konashi module

class konashi.Konashi.Konashi(name: str)

Bases: object

This class represents a single Konashi device.

Parameters

name (str) – The name (BLE advertising name) of this Konashi device.

property builtin: _Builtin

This Konashi devices Built-in interface.

async connect(timeout: float = 0.0) None

Connect to this Konashi device.

If the Konashi class instance was created directly by the user and not returned from a KonashiScanner, KonashiScanner.find() will be called internally before the connection takes place. In this case, the passed timeout value is also used for KonashiScanner.find().

Parameters

timeout (float, optional) – The connection timeout in seconds. Defaults to 0.0.

Raises
  • KonashiConnectionError – The Konashi device was found but the connection failed.

  • NotFoundError – The Konashi device was not found within the timeout time.

  • InvalidDeviceError – The specified device name was found but it does not appear to be a valid Konashi device.

async disconnect() None

Disconnect from this Konashi device.

property io: _Io

This Konashi devices I/O interface.

property name: str

The name (Bluetooth advertising name) of this Konashi device.

Returns

The Konashi device name.

Return type

str

property settings: _Settings

This Konashi devices Settings interface.

class konashi.Konashi.KonashiScanner

Bases: object

This class represents a Konashi scanner.

async static find(name: str, timeout: float = 0.0) Konashi

Find the Konashi device specified by name. This is a static method. If the timeout expires, NotFoundError is raised. If the timeout is 0.0, the search continues indefinitely.

Parameters
  • name (str) – The Konashi device name to search for.

  • timeout (float, optional) – The search timeout in seconds. Defaults to 0.0.

Raises
  • NotFoundError – The Konashi device was not found within the timeout time.

  • InvalidDeviceError – The specified device name was found but it does not appear to be a valid Konashi device.

Returns

The found Konashi device.

Return type

Konashi

property is_scanning: bool

Indicates if this scanner instance is currently scanning.

Returns

True is the scanner is scanning, otherwise False.

Return type

bool

async scan_start(cb: Callable[[Konashi], None]) None

Start scanning for Konashi devices. The search continues until cancelled and the callback is called when a device is discovered.

Parameters

cb (Callable[[Konashi], None]) – The callback for discovered devices.

Returns

A list of discovered Konashi devices.

Return type

List[Konashi]

async scan_stop() None
async static search(timeout: float = 10.0) List[Konashi]

Search for Konashi devices. The search continues for the specified timeout and a list of found devices is returned.

Parameters

timeout (float, optional) – The search timeout in seconds, has to be longer than 0s. Defaults to 10.0.

Raises

ValueError – The timeout value is invalid.

Returns

A list of discovered Konashi devices.

Return type

List[Konashi]

konashi.KonashiElementBase module

class konashi.KonashiElementBase._KonashiElementBase(konashi)

Bases: object

async _disable_notify(uuid: str) None
async _enable_notify(uuid: str, cb: Callable[[int, bytearray], None]) None
abstract async _on_connect() None
async _read(uuid: str) None
async _write(uuid: str, data: bytes) None

Module contents