forked from genewildish/Mainline
feat(figment): add trigger protocol and command types
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
36
engine/figment_trigger.py
Normal file
36
engine/figment_trigger.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Figment trigger protocol and command types.
|
||||
|
||||
Defines the extensible input abstraction for triggering figment displays
|
||||
from any control surface (ntfy, MQTT, serial, etc.).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
class FigmentAction(Enum):
|
||||
TRIGGER = "trigger"
|
||||
SET_INTENSITY = "set_intensity"
|
||||
SET_INTERVAL = "set_interval"
|
||||
SET_COLOR = "set_color"
|
||||
STOP = "stop"
|
||||
|
||||
|
||||
@dataclass
|
||||
class FigmentCommand:
|
||||
action: FigmentAction
|
||||
value: float | str | None = None
|
||||
|
||||
|
||||
class FigmentTrigger(Protocol):
|
||||
"""Protocol for figment trigger sources.
|
||||
|
||||
Any input source (ntfy, MQTT, serial) can implement this
|
||||
to trigger and control figment displays.
|
||||
"""
|
||||
|
||||
def poll(self) -> FigmentCommand | None: ...
|
||||
Reference in New Issue
Block a user