11. ykush_auxiliary

Example can be found here Controlling an Yepkit USB hub.

11.1. Ykush Auxiliary

module

ykush_auxiliary

synopsis

Auxiliary that can power on and off ports on an Ykush device.

class pykiso.lib.auxiliaries.ykush_auxiliary.PortState(value)[source]

An enumeration.

class pykiso.lib.auxiliaries.ykush_auxiliary.YkushAuxiliary(serial_number=None, **kwargs)[source]

Auxiliary used to power on and off the ports.

Initialize attribute

Parameters

serial – Serial number of the device to connect, if he is not defined then it will connect to the first Ykush device it find, defaults to None.

Raises

YkushDeviceNotFound – If no device is found or the serial number is not the serial of one device.

check_port_number(port_number)[source]

Check if the port indicated is a port of the device

Raises

YkushPortNumberError – Raise error if no port has this number

connect_device(serial=None)[source]

Find an Ykush device, will automatically connect to the first one it find, if you have multiple connected you have to precise the serial number of the device.

Parameters

serial (Optional[int]) – serial number of the device, defaults to None

Raises

YkushDeviceNotFound – if no ykush device is found

get_all_ports_state()[source]

Returns the state of all the ports.

Raises

YkushStatePortNotRetrieved – The states couldn’t be retrieved

Return type

List[PortState]

Returns

list with 0 if a port is off, 1 if on

get_firmware_version()[source]

Returns a tuple with YKUSH firmware version in format (major, minor).

Return type

Tuple[int, int]

get_number_of_port()[source]

Returns the number of port on the ykush device

Return type

int

get_port_state(port_number)[source]

Returns a specific port state.

Raises

YkushStatePortNotRetrieved – If the state couldn’t be retrieved

Return type

PortState

Returns

0 if the port is off, 1 if the port is on

get_serial_number_string()[source]

Returns the device serial number string

Return type

str

static get_str_state(state)[source]

Return the str of a state

Parameters

state (int) – 1 (port on), 0 (port off)

Return type

str

Returns

ON, OFF

is_port_off(port_number)[source]

Check if a port is off.

Return type

bool

Returns

True if a port is off, else False

is_port_on(port_number)[source]

Check if a port is on.

Return type

bool

Returns

True if a port is on, else False

set_all_ports(state)[source]

Power off or on all YKUSH ports.

Parameters

state (int) – state wanted 1 for On, 0 for Off

Raises

YkushSetStateError – if the operation had an error

set_all_ports_off()[source]

Power off all YKUSH downstreams ports.

Raises

YkushSetStateError – if the operation had an error

set_all_ports_on()[source]

Power on all YKUSH downstreams ports.

Raises

YkushSetStateError – if the operation had an error

set_port_off(port_number)[source]

Power off a specific port.

Raises

YkushSetStateError – if the operation had an error

set_port_on(port_number)[source]

Power on a specific port.

Raises

YkushSetStateError – if the operation had an error

set_port_state(port_number, state)[source]

Set a specific port On or Off.

Raises

YkushSetStateError – if the operation had an error

Parameters

state (int) – 1 (port on), 0 (port off)

exception pykiso.lib.auxiliaries.ykush_auxiliary.YkushDeviceNotFound[source]

Raised when no Ykush device is found.

exception pykiso.lib.auxiliaries.ykush_auxiliary.YkushError[source]

General Ykush specific exception used as basis for all others.

exception pykiso.lib.auxiliaries.ykush_auxiliary.YkushPortNumberError[source]

Raised when the port number doesn’t exist.

exception pykiso.lib.auxiliaries.ykush_auxiliary.YkushSetStateError[source]

Raised when a port couldn’t be switched on or off.

exception pykiso.lib.auxiliaries.ykush_auxiliary.YkushStatePortNotRetrieved[source]

Raised when the state of a port can’t be retrieved.

Warning

This auxiliary has only been tested on the Ykush Device.

Ykush 3 and Ykush XS have not been tested.

A command line to get information about the device or port can be found on the following link : https://github.com/Yepkit/ykush