State
busylight_core.vendors.thingm.implementation.state
¶
ThingM Blink(1) device state management.
This module defines the State class that manages command construction and device control for ThingM Blink(1) devices, including color control, pattern management, and LED selection.
Classes¶
busylight_core.vendors.thingm.implementation.state.State
¶
Bases: Word
Complete device state for ThingM Blink(1) commands.
The State class manages command construction for Blink(1) devices. It provides high-level methods for color control, pattern management, and device configuration while handling the low-level bit manipulation required for device communication.
Source code in src/busylight_core/vendors/thingm/implementation/state.py
Attributes¶
busylight_core.vendors.thingm.implementation.state.State.report
class-attribute
instance-attribute
¶
report = ReportField()
busylight_core.vendors.thingm.implementation.state.State.action
class-attribute
instance-attribute
¶
action = ActionField()
busylight_core.vendors.thingm.implementation.state.State.red
class-attribute
instance-attribute
¶
red = RedField()
busylight_core.vendors.thingm.implementation.state.State.green
class-attribute
instance-attribute
¶
green = GreenField()
busylight_core.vendors.thingm.implementation.state.State.blue
class-attribute
instance-attribute
¶
blue = BlueField()
busylight_core.vendors.thingm.implementation.state.State.play
class-attribute
instance-attribute
¶
play = PlayField()
busylight_core.vendors.thingm.implementation.state.State.start
class-attribute
instance-attribute
¶
start = StartField()
busylight_core.vendors.thingm.implementation.state.State.stop
class-attribute
instance-attribute
¶
stop = StopField()
busylight_core.vendors.thingm.implementation.state.State.count
class-attribute
instance-attribute
¶
count = CountField()
busylight_core.vendors.thingm.implementation.state.State.fade
class-attribute
instance-attribute
¶
fade = FadeField()
busylight_core.vendors.thingm.implementation.state.State.leds
class-attribute
instance-attribute
¶
leds = LedsField()
busylight_core.vendors.thingm.implementation.state.State.line
class-attribute
instance-attribute
¶
line = LinesField()
busylight_core.vendors.thingm.implementation.state.State.color
property
writable
¶
Get the current RGB color as a tuple.
busylight_core.vendors.thingm.implementation.state.State.initial_value
instance-attribute
¶
busylight_core.vendors.thingm.implementation.state.State.length
instance-attribute
¶
busylight_core.vendors.thingm.implementation.state.State.bits
instance-attribute
¶
busylight_core.vendors.thingm.implementation.state.State.value
property
¶
Return the integer value of the word.
busylight_core.vendors.thingm.implementation.state.State.range
property
¶
Return the range of bit offsets for this word.
busylight_core.vendors.thingm.implementation.state.State.hex
property
¶
Return a string hexadecimal representation of the word.
busylight_core.vendors.thingm.implementation.state.State.bin
property
¶
Return a string binary representation of the word.
Functions¶
busylight_core.vendors.thingm.implementation.state.State.fade_to_color
¶
fade_to_color(color, fade_ms=10, leds=All)
Configure device to fade to specified color.
:param color: RGB color tuple (red, green, blue) with values 0-255 :param fade_ms: Fade duration in milliseconds :param leds: Which LEDs to control (All, Top, or Bottom)
Source code in src/busylight_core/vendors/thingm/implementation/state.py
busylight_core.vendors.thingm.implementation.state.State.write_pattern_line
¶
Write a single line to the device's pattern memory.
:param color: RGB color tuple for this pattern line :param fade_ms: Fade duration for this pattern step :param index: Pattern line index (0-15)
Source code in src/busylight_core/vendors/thingm/implementation/state.py
busylight_core.vendors.thingm.implementation.state.State.save_patterns
¶
Save current pattern memory to device flash storage.
Source code in src/busylight_core/vendors/thingm/implementation/state.py
busylight_core.vendors.thingm.implementation.state.State.play_loop
¶
Start pattern playback loop.
:param play: Play mode (0=stop, 1=play) :param start: Starting pattern line index :param stop: Ending pattern line index :param count: Number of loops (0=infinite)
Source code in src/busylight_core/vendors/thingm/implementation/state.py
busylight_core.vendors.thingm.implementation.state.State.clear_patterns
¶
Clear pattern memory by writing black to specified range.
:param start: Starting pattern line index :param count: Number of pattern lines to clear