Skip to content

Embrava Implementation

Blynclight series with audio capabilities

This module contains the low-level implementation details for Embrava devices, including enumerations, bit fields, and state management classes.

Available Components

Embrava device implementation details.

Attributes

busylight_core.vendors.embrava.implementation.BLYNCUSB_COLOR_TO_RGB module-attribute

BLYNCUSB_COLOR_TO_RGB = {
    WHITE: (255, 255, 255),
    CYAN: (0, 255, 255),
    MAGENTA: (255, 0, 255),
    BLUE: (0, 0, 255),
    YELLOW: (255, 255, 0),
    GREEN: (0, 255, 0),
    RED: (255, 0, 0),
    OFF: (0, 0, 0),
}

busylight_core.vendors.embrava.implementation.BLYNCUSB_TO_TENX20 module-attribute

BLYNCUSB_TO_TENX20 = {
    RED: RED,
    GREEN: GREEN,
    BLUE: BLUE,
    YELLOW: YELLOW,
    MAGENTA: MAGENTA,
    WHITE: WHITE,
    CYAN: CYAN,
    OFF: OFF,
}

busylight_core.vendors.embrava.implementation.FlashSpeed module-attribute

FlashSpeed = BlynclightFlashSpeed

busylight_core.vendors.embrava.implementation.State module-attribute

Classes

busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed

Bases: IntEnum

Flash speed enumeration for Embrava Blynclight devices.

Defines the available flash speeds for the LED indicator. These values control how quickly the device cycles when in flash mode.

Attributes
busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed.slow class-attribute instance-attribute
slow = 1
busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed.medium class-attribute instance-attribute
medium = 2
busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed.fast class-attribute instance-attribute
fast = 4

busylight_core.vendors.embrava.implementation.BlueField

BlueField()

Bases: BitField

8-bit blue color component.

Attributes
busylight_core.vendors.embrava.implementation.BlueField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.BlueField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.BlueField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.DimBit

DimBit()

Bases: BitField

1-bit field to dim light, clear to brighten light.

Attributes
busylight_core.vendors.embrava.implementation.DimBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.DimBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.DimBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.FlashBit

FlashBit()

Bases: BitField

1-bit field to flash light, clear to stop flashing.

Attributes
busylight_core.vendors.embrava.implementation.FlashBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.FlashBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.FlashBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.GreenField

GreenField()

Bases: BitField

8-bit green color component.

Attributes
busylight_core.vendors.embrava.implementation.GreenField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.GreenField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.GreenField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.MusicField

MusicField()

Bases: BitField

4-bit field to select music to play, ranges from 0 to 15.

Attributes
busylight_core.vendors.embrava.implementation.MusicField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.MusicField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.MusicField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.MuteBit

MuteBit()

Bases: BitField

1-bit field to mute sound, clear to enable sound.

Attributes
busylight_core.vendors.embrava.implementation.MuteBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.MuteBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.MuteBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.OffBit

OffBit()

Bases: BitField

1-bit field to turn light off, clear to turn light on.

Attributes
busylight_core.vendors.embrava.implementation.OffBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.OffBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.OffBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.PlayBit

PlayBit()

Bases: BitField

1-bit field to play sound, clear to stop sound.

Attributes
busylight_core.vendors.embrava.implementation.PlayBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.PlayBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.PlayBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.RedField

RedField()

Bases: BitField

8-bit red color component.

Attributes
busylight_core.vendors.embrava.implementation.RedField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.RedField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.RedField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.RepeatBit

RepeatBit()

Bases: BitField

1-bit field to repeat sound, clear to play sound once.

Attributes
busylight_core.vendors.embrava.implementation.RepeatBit.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.RepeatBit.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.RepeatBit.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.SpeedField

SpeedField()

Bases: BitField

3-bit field to set flash speed: 1=slow, 2=medium, 4=fast.

Attributes
busylight_core.vendors.embrava.implementation.SpeedField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.SpeedField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.SpeedField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.VolumeField

VolumeField()

Bases: BitField

4-bit field to set volume level, ranges from 0 to 15.

Attributes
busylight_core.vendors.embrava.implementation.VolumeField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.embrava.implementation.VolumeField.offset instance-attribute
offset = offset
busylight_core.vendors.embrava.implementation.VolumeField.width instance-attribute
width = width

busylight_core.vendors.embrava.implementation.BlynclightState

BlynclightState()

Bases: Word

Complete device state for Embrava Blynclight commands.

The State class manages the full command structure sent to Embrava devices. It controls both LED behavior (color, brightness, flashing) and audio functionality (ringtones, volume, playback control). The state is serialized to bytes for transmission to the hardware.

Attributes
busylight_core.vendors.embrava.implementation.BlynclightState.initial_value instance-attribute
initial_value = value
busylight_core.vendors.embrava.implementation.BlynclightState.length instance-attribute
length = length
busylight_core.vendors.embrava.implementation.BlynclightState.bits instance-attribute
bits = array('B', [value >> n & 1 for n in range])
busylight_core.vendors.embrava.implementation.BlynclightState.value property
value

Return the integer value of the word.

busylight_core.vendors.embrava.implementation.BlynclightState.range property
range

Return the range of bit offsets for this word.

busylight_core.vendors.embrava.implementation.BlynclightState.hex property
hex

Return a string hexadecimal representation of the word.

busylight_core.vendors.embrava.implementation.BlynclightState.bin property
bin

Return a string binary representation of the word.

busylight_core.vendors.embrava.implementation.BlynclightState.red class-attribute instance-attribute
red = RedField()
busylight_core.vendors.embrava.implementation.BlynclightState.blue class-attribute instance-attribute
blue = BlueField()
busylight_core.vendors.embrava.implementation.BlynclightState.green class-attribute instance-attribute
green = GreenField()
busylight_core.vendors.embrava.implementation.BlynclightState.off class-attribute instance-attribute
off = OffBit()
busylight_core.vendors.embrava.implementation.BlynclightState.dim class-attribute instance-attribute
dim = DimBit()
busylight_core.vendors.embrava.implementation.BlynclightState.flash class-attribute instance-attribute
flash = FlashBit()
busylight_core.vendors.embrava.implementation.BlynclightState.speed class-attribute instance-attribute
speed = SpeedField()
busylight_core.vendors.embrava.implementation.BlynclightState.repeat class-attribute instance-attribute
repeat = RepeatBit()
busylight_core.vendors.embrava.implementation.BlynclightState.play class-attribute instance-attribute
play = PlayBit()
busylight_core.vendors.embrava.implementation.BlynclightState.music class-attribute instance-attribute
music = MusicField()
busylight_core.vendors.embrava.implementation.BlynclightState.volume class-attribute instance-attribute
volume = VolumeField()
busylight_core.vendors.embrava.implementation.BlynclightState.mute class-attribute instance-attribute
mute = MuteBit()
Functions
busylight_core.vendors.embrava.implementation.BlynclightState.clear
clear()

Clear all bits in the word.

busylight_core.vendors.embrava.implementation.BlynclightState.reset
reset()

Reset the state to default values.

Sets the device to off state with no audio playback and default flash speed settings.

busylight_core.vendors.embrava.implementation.BlyncusbColor

Bases: IntEnum

Predefined color values for early Blynclight devices.

The blynux protocol uses a 4-bit color mask in the high nibble of byte 7. These values are the mask before shifting.

Attributes
busylight_core.vendors.embrava.implementation.BlyncusbColor.WHITE class-attribute instance-attribute
WHITE = 8
busylight_core.vendors.embrava.implementation.BlyncusbColor.CYAN class-attribute instance-attribute
CYAN = 9
busylight_core.vendors.embrava.implementation.BlyncusbColor.MAGENTA class-attribute instance-attribute
MAGENTA = 10
busylight_core.vendors.embrava.implementation.BlyncusbColor.BLUE class-attribute instance-attribute
BLUE = 11
busylight_core.vendors.embrava.implementation.BlyncusbColor.YELLOW class-attribute instance-attribute
YELLOW = 12
busylight_core.vendors.embrava.implementation.BlyncusbColor.GREEN class-attribute instance-attribute
GREEN = 13
busylight_core.vendors.embrava.implementation.BlyncusbColor.RED class-attribute instance-attribute
RED = 14
busylight_core.vendors.embrava.implementation.BlyncusbColor.OFF class-attribute instance-attribute
OFF = 15

busylight_core.vendors.embrava.implementation.Tenx20Color

Bases: IntEnum

Color codes for TENX20 chipset (PID 0x1E00).

Single-byte color codes used in the TENX20 protocol.

Attributes
busylight_core.vendors.embrava.implementation.Tenx20Color.RED class-attribute instance-attribute
RED = 96
busylight_core.vendors.embrava.implementation.Tenx20Color.GREEN class-attribute instance-attribute
GREEN = 216
busylight_core.vendors.embrava.implementation.Tenx20Color.BLUE class-attribute instance-attribute
BLUE = 53
busylight_core.vendors.embrava.implementation.Tenx20Color.YELLOW class-attribute instance-attribute
YELLOW = 64
busylight_core.vendors.embrava.implementation.Tenx20Color.MAGENTA class-attribute instance-attribute
MAGENTA = 32
busylight_core.vendors.embrava.implementation.Tenx20Color.WHITE class-attribute instance-attribute
WHITE = 7
busylight_core.vendors.embrava.implementation.Tenx20Color.CYAN class-attribute instance-attribute
CYAN = 23
busylight_core.vendors.embrava.implementation.Tenx20Color.OFF class-attribute instance-attribute
OFF = 115

Functions

busylight_core.vendors.embrava.implementation.rgb_to_blyncusb_color

rgb_to_blyncusb_color(red, green, blue)

Map an RGB color to the nearest predefined BlyncusbColor enum.

Convenience wrapper around snap_color for protocol code that needs the enum value directly.

:param red: Red component (0-255) :param green: Green component (0-255) :param blue: Blue component (0-255) :return: The closest BlyncusbColor match

busylight_core.vendors.embrava.implementation.snap_color

snap_color(red, green, blue)

Map an RGB color to the nearest predefined Blyncusb palette color.

Since these devices only support 7 colors plus OFF, this finds the best match based on which channels are dominant and returns the canonical RGB for that palette entry.

:param red: Red component (0-255) :param green: Green component (0-255) :param blue: Blue component (0-255) :return: The canonical RGB tuple for the nearest palette color