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
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
¶
busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed.medium
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlynclightFlashSpeed.fast
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlueField
¶
busylight_core.vendors.embrava.implementation.DimBit
¶
busylight_core.vendors.embrava.implementation.FlashBit
¶
busylight_core.vendors.embrava.implementation.GreenField
¶
busylight_core.vendors.embrava.implementation.MusicField
¶
busylight_core.vendors.embrava.implementation.MuteBit
¶
busylight_core.vendors.embrava.implementation.OffBit
¶
busylight_core.vendors.embrava.implementation.PlayBit
¶
busylight_core.vendors.embrava.implementation.RedField
¶
busylight_core.vendors.embrava.implementation.RepeatBit
¶
busylight_core.vendors.embrava.implementation.SpeedField
¶
busylight_core.vendors.embrava.implementation.VolumeField
¶
busylight_core.vendors.embrava.implementation.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
¶
busylight_core.vendors.embrava.implementation.BlynclightState.length
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlynclightState.bits
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlynclightState.value
property
¶
Return the integer value of the word.
busylight_core.vendors.embrava.implementation.BlynclightState.range
property
¶
Return the range of bit offsets for this word.
busylight_core.vendors.embrava.implementation.BlynclightState.hex
property
¶
Return a string hexadecimal representation of the word.
busylight_core.vendors.embrava.implementation.BlynclightState.bin
property
¶
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 all bits in the word.
busylight_core.vendors.embrava.implementation.BlynclightState.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
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.CYAN
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.MAGENTA
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.BLUE
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.YELLOW
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.GREEN
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.RED
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.BlyncusbColor.OFF
class-attribute
instance-attribute
¶
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
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.GREEN
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.BLUE
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.YELLOW
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.MAGENTA
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.WHITE
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.CYAN
class-attribute
instance-attribute
¶
busylight_core.vendors.embrava.implementation.Tenx20Color.OFF
class-attribute
instance-attribute
¶
Functions¶
busylight_core.vendors.embrava.implementation.rgb_to_blyncusb_color
¶
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
¶
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