This Python script connects to a QLC+ WebSocket server and demonstrates basic control of DMX channels and universe resets. It dynamically determines the host machine's IP address, allowing seamless integration with the local QLC+ server.
- Dynamically resolves the host computer's IP address.
- Connects to QLC+ WebSocket server for remote control.
- Demonstrates the following QLC+ actions:
- Set a channel value to full (255).
- Reset a channel value to zero (0).
- Reset the entire universe of channels.
Here’s what the workspace looks like:
.
├── dmx_control.py # Python script for controlling QLC+ via WebSocket
├── keypad.html # HTML file for keypad interface
├── qlight_workspace.qxw # QLC+ workspace file
├── README.md # Project documentation
└── requirements.txt # Python dependencies
-
Python Requirements:
- Python 3.x
- Install the dependencies from
requirements.txt
:pip install -r requirements.txt
-
QLC+ Setup:
- Ensure QLC+ is installed and running on the host machine.
- Start QLC+ with the web interface enabled:
qlcplus -w
- Default WebSocket port:
9999
.
- The script uses the
socket
module to determine the host machine's IP address. - Establishes a WebSocket connection to the QLC+ server.
- Sends example commands to demonstrate channel control and universe reset.
- Clone or download the project files.
- Install dependencies:
pip install -r requirements.txt
- Run the script:
python dmx_control.py
- The script will:
- Automatically determine the local IP address.
- Connect to the QLC+ WebSocket server.
- Execute example actions (channel control and universe reset).
Connected to QLC+ WebSocket at ws://192.168.1.100:9999/qlcplusWS.
Sent: CH|1|255 (Channel 1 -> 255)
Sent: CH|1|0 (Channel 1 -> 0)
Sent: QLC+API|sdResetUniverse (Reset all channels in current Universe)
WebSocket closed.
Dependencies listed in requirements.txt
:
certifi==2024.12.14
charset-normalizer==3.4.1
idna==3.10
requests==2.32.3
urllib3==2.3.0
websocket-client==1.8.0
Install them using:
pip install -r requirements.txt
- Python script for connecting to QLC+ via WebSocket and sending control commands.
- Dynamically retrieves the host machine's IP address using a dummy connection to an external address.
- Establishes a WebSocket connection to QLC+.
- Sends example commands to control DMX channels.
- QLC+ WebSocket URL: Modify the
QLC_WS_URL
indmx_control.py
if using a custom IP or port. - Commands: Replace the example commands with desired QLC+ WebSocket messages.
- If the local IP cannot be determined, the script defaults to
127.0.0.1
. - Catches and prints any exceptions during execution.
This script is open-source and available under the MIT License.