toio.cube.api.indicator module

class toio.cube.api.indicator.Color(r: int, g: int, b: int)[source]

Bases: object

Indicator color in RGB

r: int

R value (0 - 255)

g: int

G value (0 - 255)

b: int

B value (0 - 255)

flatten()[source]

Return the tuple representation of this dataclass

__init__(r: int, g: int, b: int) None
class toio.cube.api.indicator.IndicatorParam(duration_ms: int, color: Color)[source]

Bases: object

Indicator color and lighting period

duration_ms: int
Duration of lighting:
Any fraction less than 10ms will be truncated.
0 - 9: no time limit
10 - 2550: duration [ms]
color: Color
RGB value
flatten()[source]
__init__(duration_ms: int, color: Color) None
class toio.cube.api.indicator.TurningOnAndOff(param: IndicatorParam)[source]

Bases: CubeCommand

Indicator turning on / off command

References

https://toio.github.io/toio-spec/en/docs/ble_light#turning-the-indicator-on-and-off

__init__(param: IndicatorParam)[source]
__bytes__() bytes[source]

Returns the byte representation of this class to be sent to cube.

Returns:

byte representation of this class to be sent to cube.

Return type:

bytes

class toio.cube.api.indicator.RepeatedTurningOnAndOff(repeat: int, param_list: list[toio.cube.api.indicator.IndicatorParam] | tuple[toio.cube.api.indicator.IndicatorParam, ...])[source]

Bases: CubeCommand

Repeated indicator turning on /off command

References

https://toio.github.io/toio-spec/en/docs/ble_light#repeated-turning-on-and-off-of-indicator

REPEAT_INFINITE = 0
__init__(repeat: int, param_list: list[toio.cube.api.indicator.IndicatorParam] | tuple[toio.cube.api.indicator.IndicatorParam, ...]) None[source]
__bytes__() bytes[source]

Returns the byte representation of this class to be sent to cube.

Returns:

byte representation of this class to be sent to cube.

Return type:

bytes

class toio.cube.api.indicator.TurnOffAll[source]

Bases: CubeCommand

Indicator all off command

References

https://toio.github.io/toio-spec/en/docs/ble_light#turn-off-all-indicators

__init__() None[source]
__bytes__() bytes[source]

Returns the byte representation of this class to be sent to cube.

Returns:

byte representation of this class to be sent to cube.

Return type:

bytes

class toio.cube.api.indicator.TurnOff(indicator_id: int)[source]

Bases: CubeCommand

Indicator off command

References

https://toio.github.io/toio-spec/en/docs/ble_light#turn-off-a-specific-indicator

__init__(indicator_id: int) None[source]
__bytes__() bytes[source]

Returns the byte representation of this class to be sent to cube.

Returns:

byte representation of this class to be sent to cube.

Return type:

bytes

class toio.cube.api.indicator.Indicator(interface: CubeInterface)[source]

Bases: CubeCharacteristic

Indicator characteristic

References

https://toio.github.io/toio-spec/en/docs/ble_light

static is_my_data(_payload: bytearray) None[source]

If payload is my characteristic response, this function returns CubeResponse object. Otherwise, it returns None.

Parameters:

payload (GattReadData) – received data from the cube.

__init__(interface: CubeInterface)[source]
async turn_on(param: IndicatorParam) None[source]

Send indicator turn on / off command

Parameters:

param – Indicator parameter

References

https://toio.github.io/toio-spec/en/docs/ble_light#repeated-turning-on-and-off-of-indicator

async repeated_turn_on(repeat: int, param_list: list[toio.cube.api.indicator.IndicatorParam] | tuple[toio.cube.api.indicator.IndicatorParam, ...]) None[source]

Send repeated indicator turning on / off command

Parameters:

References

https://toio.github.io/toio-spec/en/docs/ble_light#repeated-turning-on-and-off-of-indicator

async turn_off_all() None[source]

Send all off command

References

https://toio.github.io/toio-spec/en/docs/ble_light#turn-off-all-indicators

async turn_off(indicator_id: int) None[source]

Send off command

Parameters:

indicator_id (int) – Indicator ID

References

https://toio.github.io/toio-spec/en/docs/ble_light#turn-off-a-specific-indicator