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
Links
signalrgb.model.Links
dataclass
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
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
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
🛠️ 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
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
📐 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
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
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
💾 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
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
⚠️ 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
🔄 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
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
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
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
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
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
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
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
💡 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