Skip to content

SignalRGB Models API Reference

This page provides detailed API documentation for the data models used in the SignalRGB Python client. These models represent various data structures used in the SignalRGB API, including effects, responses, and error information.

🔍 Core Models

Attributes

signalrgb.model.Attributes dataclass

Bases: DataClassDictMixin

Attributes of an effect in SignalRGB.

This class represents the various properties and capabilities of an effect. It includes details such as the effect's name, description, publisher, and various flags indicating the effect's capabilities.

Attributes:

Name Type Description
description Optional[str]

A description of the effect.

developer_effect bool

Indicates whether this is a developer-created effect.

image Optional[str]

URL or path to the effect's image, if available.

name str

The name of the effect.

parameters Dict[str, Any]

A dictionary of effect-specific parameters.

publisher Optional[str]

The publisher or creator of the effect.

uses_audio bool

Indicates whether the effect uses audio input.

uses_input bool

Indicates whether the effect uses user input.

uses_meters bool

Indicates whether the effect uses meter data.

uses_video bool

Indicates whether the effect uses video input.

Source code in signalrgb/model.py
@dataclass
class Attributes(DataClassDictMixin):
    """
    Attributes of an effect in SignalRGB.

    This class represents the various properties and capabilities of an effect.
    It includes details such as the effect's name, description, publisher, and various flags
    indicating the effect's capabilities.

    Attributes:
        description (Optional[str]): A description of the effect.
        developer_effect (bool): Indicates whether this is a developer-created effect.
        image (Optional[str]): URL or path to the effect's image, if available.
        name (str): The name of the effect.
        parameters (Dict[str, Any]): A dictionary of effect-specific parameters.
        publisher (Optional[str]): The publisher or creator of the effect.
        uses_audio (bool): Indicates whether the effect uses audio input.
        uses_input (bool): Indicates whether the effect uses user input.
        uses_meters (bool): Indicates whether the effect uses meter data.
        uses_video (bool): Indicates whether the effect uses video input.
    """

    name: str
    description: str | None = None
    developer_effect: bool = False
    image: str | None = None
    parameters: dict[str, Any] = field(default_factory=dict)
    publisher: str | None = None
    uses_audio: bool = False
    uses_input: bool = False
    uses_meters: bool = False
    uses_video: bool = False

Bases: DataClassDictMixin

Links associated with an effect in SignalRGB.

This class represents the URLs related to an effect, such as where to apply it or retrieve its details.

Attributes:

Name Type Description
apply Optional[str]

URL to apply the effect, if available.

self_link Optional[str]

URL of the effect itself, typically for retrieving its details.

Source code in signalrgb/model.py
@dataclass
class Links(DataClassDictMixin):
    """
    Links associated with an effect in SignalRGB.

    This class represents the URLs related to an effect, such as where to apply it
    or retrieve its details.

    Attributes:
        apply (Optional[str]): URL to apply the effect, if available.
        self_link (Optional[str]): URL of the effect itself, typically for retrieving its details.
    """

    apply: str | None = None
    self_link: str | None = None

    class Config(BaseConfig):
        aliases = {"self_link": "self"}

Effect

signalrgb.model.Effect dataclass

Bases: DataClassDictMixin

Represents a single effect in SignalRGB.

This class combines the attributes and links of an effect with its unique identifier. It provides a complete representation of an effect in the SignalRGB system.

Attributes:

Name Type Description
attributes Attributes

The attributes of the effect.

id str

Unique identifier of the effect.

links Links

Links associated with the effect.

type str

Type of the object, typically 'effect'.

Source code in signalrgb/model.py
@dataclass
class Effect(DataClassDictMixin):
    """
    Represents a single effect in SignalRGB.

    This class combines the attributes and links of an effect with its unique identifier.
    It provides a complete representation of an effect in the SignalRGB system.

    Attributes:
        attributes (Attributes): The attributes of the effect.
        id (str): Unique identifier of the effect.
        links (Links): Links associated with the effect.
        type (str): Type of the object, typically 'effect'.
    """

    attributes: Attributes
    id: str
    links: Links
    type: str

EffectList

signalrgb.model.EffectList dataclass

Bases: DataClassDictMixin

A list of effects in SignalRGB.

This class is used to represent multiple effects, typically in API responses that return a collection of effects.

Attributes:

Name Type Description
items List[Effect]

A list of Effect objects.

Source code in signalrgb/model.py
@dataclass
class EffectList(DataClassDictMixin):
    """
    A list of effects in SignalRGB.

    This class is used to represent multiple effects, typically in API responses
    that return a collection of effects.

    Attributes:
        items (List[Effect]): A list of Effect objects.
    """

    items: list[Effect] = field(default_factory=list)

🛠️ State Models

CurrentState

signalrgb.model.CurrentState dataclass

Bases: DataClassDictMixin

Represents the current state of a SignalRGB instance.

This class includes the current state of the instance, such as the current effect, whether the canvas is enabled, and the global brightness level.

Attributes:

Name Type Description
name str

The name of the current effect.

enabled bool

Indicates whether the canvas is currently enabled.

global_brightness int

The global brightness level of the canvas.

Source code in signalrgb/model.py
@dataclass
class CurrentState(DataClassDictMixin):
    """
    Represents the current state of a SignalRGB instance.

    This class includes the current state of the instance, such as the current effect,
    whether the canvas is enabled, and the global brightness level.

    Attributes:
        name (str): The name of the current effect.
        enabled (bool): Indicates whether the canvas is currently enabled.
        global_brightness (int): The global brightness level of the canvas.
    """

    name: str | None = None
    enabled: bool = False
    global_brightness: int = 0

CurrentStateHolder

signalrgb.model.CurrentStateHolder dataclass

Bases: DataClassDictMixin

Holds the current state and metadata

Attributes:

Name Type Description
attributes Attributes

The attributes of the state.

id str

Unique identifier of the current effect.

links Links

Links associated with the current effect.

type str

Type of the object, typically 'effect'.

Source code in signalrgb/model.py
@dataclass
class CurrentStateHolder(DataClassDictMixin):
    """
    Holds the current state and metadata

    Attributes:
        attributes (Attributes): The attributes of the state.
        id (str): Unique identifier of the current effect.
        links (Links): Links associated with the current effect.
        type (str): Type of the object, typically 'effect'.
    """

    attributes: CurrentState
    id: str
    links: Links
    type: str

📐 Layout Models

Layout

signalrgb.model.Layout dataclass

Bases: DataClassDictMixin

Represents a layout in SignalRGB.

This class represents a layout, which is a configuration of devices and their positions.

Attributes:

Name Type Description
id str

The unique identifier of the layout.

type str

The type of the layout, typically 'layout'.

Source code in signalrgb/model.py
@dataclass
class Layout(DataClassDictMixin):
    """
    Represents a layout in SignalRGB.

    This class represents a layout, which is a configuration of devices and their positions.

    Attributes:
        id (str): The unique identifier of the layout.
        type (str): The type of the layout, typically 'layout'.
    """

    id: str
    type: str

LayoutList

signalrgb.model.LayoutList dataclass

Bases: DataClassDictMixin

A list of layouts in SignalRGB.

This class is used to represent a layout, typically in API responses that return a collection of layouts.

Attributes:

Name Type Description
items List[Effect]

A list of Layout objects.

Source code in signalrgb/model.py
@dataclass
class LayoutList(DataClassDictMixin):
    """
    A list of layouts in SignalRGB.

    This class is used to represent a layout, typically in API responses
    that return a collection of layouts.

    Attributes:
        items (List[Effect]): A list of Layout objects.
    """

    items: list[Layout] = field(default_factory=list)

CurrentLayoutHolder

signalrgb.model.CurrentLayoutHolder dataclass

Bases: DataClassDictMixin

Holds the current layout information.

Attributes:

Name Type Description
current_layout Layout

The current layout.

Source code in signalrgb/model.py
@dataclass
class CurrentLayoutHolder(DataClassDictMixin):
    """
    Holds the current layout information.

    Attributes:
        current_layout (Layout): The current layout.
    """

    current_layout: Layout

💾 Preset Models

EffectPreset

signalrgb.model.EffectPreset dataclass

Bases: DataClassDictMixin

Represents a preset for an effect in SignalRGB.

Attributes:

Name Type Description
id str

The unique identifier of the preset.

type str

The type of the preset, typically 'preset'.

Source code in signalrgb/model.py
@dataclass
class EffectPreset(DataClassDictMixin):
    """
    Represents a preset for an effect in SignalRGB.

    Attributes:
        id (str): The unique identifier of the preset.
        type (str): The type of the preset, typically 'preset'.
    """

    id: str
    type: str

EffectPresetList

signalrgb.model.EffectPresetList dataclass

Bases: DataClassDictMixin

A list of effect presets in SignalRGB.

Attributes:

Name Type Description
id str

The ID of the effect these presets belong to.

items List[EffectPreset]

A list of EffectPreset objects.

type str

The type of this object, typically 'presets'.

Source code in signalrgb/model.py
@dataclass
class EffectPresetList(DataClassDictMixin):
    """
    A list of effect presets in SignalRGB.

    Attributes:
        id (str): The ID of the effect these presets belong to.
        items (List[EffectPreset]): A list of EffectPreset objects.
        type (str): The type of this object, typically 'presets'.
    """

    id: str
    items: list[EffectPreset] = field(default_factory=list)

⚠️ Error Models

Error

signalrgb.model.Error dataclass

Bases: DataClassDictMixin

Represents an error returned by the SignalRGB API.

This class includes details about the error such as its code, title, and a detailed message. It is typically used when the API encounters an error during request processing.

Attributes:

Name Type Description
code Optional[str]

An error code, if provided by the API.

detail Optional[str]

A detailed error message explaining the issue.

title str

A brief title or summary of the error.

Source code in signalrgb/model.py
@dataclass
class Error(DataClassDictMixin):
    """
    Represents an error returned by the SignalRGB API.

    This class includes details about the error such as its code, title, and a detailed message.
    It is typically used when the API encounters an error during request processing.

    Attributes:
        code (Optional[str]): An error code, if provided by the API.
        detail (Optional[str]): A detailed error message explaining the issue.
        title (str): A brief title or summary of the error.
    """

    title: str
    code: str | None = None
    detail: str | None = None

🔄 Response Models

SignalRGBResponse

signalrgb.model.SignalRGBResponse dataclass

Bases: DataClassDictMixin

Base class for responses from the SignalRGB API.

This class includes common fields found in all API responses. It serves as a base for more specific response types and provides a consistent structure for handling API responses.

Attributes:

Name Type Description
api_version str

The version of the API used for this response.

id int

A unique identifier for this response.

method str

The HTTP method used for the request that generated this response.

params Dict[str, Any]

Any parameters that were part of the request.

status str

The status of the response, typically 'ok' or 'error'.

errors List[Error]

A list of Error objects if any errors occurred.

Source code in signalrgb/model.py
@dataclass
class SignalRGBResponse(DataClassDictMixin):
    """
    Base class for responses from the SignalRGB API.

    This class includes common fields found in all API responses. It serves as a base
    for more specific response types and provides a consistent structure for handling
    API responses.

    Attributes:
        api_version (str): The version of the API used for this response.
        id (int): A unique identifier for this response.
        method (str): The HTTP method used for the request that generated this response.
        params (Dict[str, Any]): Any parameters that were part of the request.
        status (str): The status of the response, typically 'ok' or 'error'.
        errors (List[Error]): A list of Error objects if any errors occurred.
    """

    api_version: str
    id: int
    method: str
    status: str
    params: dict[str, Any] = field(default_factory=dict)
    errors: list[Error] = field(default_factory=list)

EffectDetailsResponse

signalrgb.model.EffectDetailsResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return details of a single effect.

This class extends SignalRGBResponse and includes an additional field for the effect details.

Attributes:

Name Type Description
data Optional[Effect]

The details of the requested effect, if available.

Source code in signalrgb/model.py
@dataclass
class EffectDetailsResponse(SignalRGBResponse):
    """
    Response model for requests that return details of a single effect.

    This class extends SignalRGBResponse and includes an additional field for
    the effect details.

    Attributes:
        data (Optional[Effect]): The details of the requested effect, if available.
    """

    data: Effect | None = None

EffectListResponse

signalrgb.model.EffectListResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return a list of effects.

This class extends SignalRGBResponse and includes an additional field for the list of effects.

Attributes:

Name Type Description
data Optional[EffectList]

The list of effects returned by the API, if available.

Source code in signalrgb/model.py
@dataclass
class EffectListResponse(SignalRGBResponse):
    """
    Response model for requests that return a list of effects.

    This class extends SignalRGBResponse and includes an additional field for
    the list of effects.

    Attributes:
        data (Optional[EffectList]): The list of effects returned by the API, if available.
    """

    data: EffectList | None = None

CurrentStateResponse

signalrgb.model.CurrentStateResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return the current state of the canvas.

This class extends SignalRGBResponse and includes an additional field for the current state of the canvas.

Attributes:

Name Type Description
data Optional[CurrentStateHolder]

The current state of the canvas, if available.

Source code in signalrgb/model.py
@dataclass
class CurrentStateResponse(SignalRGBResponse):
    """
    Response model for requests that return the current state of the canvas.

    This class extends SignalRGBResponse and includes an additional field for
    the current state of the canvas.

    Attributes:
        data (Optional[CurrentStateHolder]): The current state of the canvas, if available.
    """

    data: CurrentStateHolder | None = None

LayoutListResponse

signalrgb.model.LayoutListResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return a list of layouts.

This class extends SignalRGBResponse and includes an additional field for the list of layouts.

Attributes:

Name Type Description
data Optional[Dict[str, Any]]

The data containing the list of layouts returned by the API, if available.

Source code in signalrgb/model.py
@dataclass
class LayoutListResponse(SignalRGBResponse):
    """
    Response model for requests that return a list of layouts.

    This class extends SignalRGBResponse and includes an additional field for
    the list of layouts.

    Attributes:
        data (Optional[Dict[str, Any]]): The data containing the list of layouts returned by the API, if available.
    """

    data: dict[str, Any] | None = None

CurrentLayoutResponse

signalrgb.model.CurrentLayoutResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return the current layout.

This class extends SignalRGBResponse and includes an additional field for the current layout.

Attributes:

Name Type Description
data Optional[CurrentLayoutHolder]

The data containing the current layout returned by the API, if available.

Source code in signalrgb/model.py
@dataclass
class CurrentLayoutResponse(SignalRGBResponse):
    """
    Response model for requests that return the current layout.

    This class extends SignalRGBResponse and includes an additional field for
    the current layout.

    Attributes:
        data (Optional[CurrentLayoutHolder]): The data containing the current layout returned by the API, if available.
    """

    data: CurrentLayoutHolder | None = None

EffectPresetListResponse

signalrgb.model.EffectPresetListResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return a list of effect presets.

Attributes:

Name Type Description
data Optional[EffectPresetList]

The list of effect presets returned by the API, if available.

Source code in signalrgb/model.py
@dataclass
class EffectPresetListResponse(SignalRGBResponse):
    """
    Response model for requests that return a list of effect presets.

    Attributes:
        data (Optional[EffectPresetList]): The list of effect presets returned by the API, if available.
    """

    data: EffectPresetList | None = None

EffectPresetResponse

signalrgb.model.EffectPresetResponse dataclass

Bases: SignalRGBResponse

Response model for requests that return details of a single effect preset.

Attributes:

Name Type Description
data Optional[EffectPreset]

The details of the requested effect preset, if available.

Source code in signalrgb/model.py
@dataclass
class EffectPresetResponse(SignalRGBResponse):
    """
    Response model for requests that return details of a single effect preset.

    Attributes:
        data (Optional[EffectPreset]): The details of the requested effect preset, if available.
    """

    data: EffectPreset | None = None

💡 Usage Example

Here's a basic example of how to work with these models:

from signalrgb import SignalRGBClient
from signalrgb.model import Effect, Attributes

# Initialize the client
client = SignalRGBClient()

# Get an effect
effect: Effect = client.get_effect_by_name("Sakura")

# Access effect attributes
print(f"Effect name: {effect.attributes.name}")
print(f"Effect description: {effect.attributes.description}")
print(f"Effect uses audio: {effect.attributes.uses_audio}")

# Extract parameters
parameters = effect.attributes.parameters
for param_name, param_data in parameters.items():
    print(f"Parameter: {param_name}")
    print(f"  Type: {param_data.get('type', 'Unknown')}")
    print(f"  Value: {param_data.get('value')}")

# Working with async client
import asyncio
from signalrgb import AsyncSignalRGBClient

async def get_effect_info():
    async with AsyncSignalRGBClient() as client:
        effect = await client.get_effect_by_name("Rainbow Wave")
        return effect.attributes.name, effect.id

# Run the async code
name, effect_id = asyncio.run(get_effect_info())
print(f"Got effect: {name} with ID: {effect_id}")

For more detailed usage examples, please refer to: - Python Library Usage for the synchronous client - Asynchronous Library Usage for the async client