Control USB Relay for Openclaw

A robust skill for AI agents to programmatically control physical USB relay modules for hardware automation and power management.

lj-hao
v1.0.2
Mar 17, 2026
0
878
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install control-usb-relay

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install control-usb-relay using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Control USB Relay?

The Control USB Relay skill empowers AI coding agents to bridge the gap between software logic and physical hardware. By utilizing Openclaw Skills, developers can automate the switching of external devices, manage power cycles, and integrate physical triggers into their broader automation workflows. This skill specifically targets Linux environments where USB relay modules are controlled via serial communication.

Built to handle the nuances of serial protocols, this skill ensures reliable interaction with hardware modules. It simplifies the complexity of sending hex commands to serial ports, making it easier for agents to perform tasks like restarting a router, toggling laboratory equipment, or managing smart office peripherals through Openclaw Skills.

Control USB Relay Use Cases

  • Programmatic power cycling of hardware during automated testing or CI/CD runs.
  • Integration of physical hardware switches into IoT and smart home automation scripts.
  • Automated device management based on environmental sensor data or software triggers.
  • Controlling peripheral power usage in remote server environments using Openclaw Skills.

How Control USB Relay Works

  1. The skill identifies the target relay module, typically mapped to the /dev/ttyUSB1 serial port.
  2. It verifies system permissions to ensure the agent has access to the dialout group required for serial communication.
  3. A connection is established using the relay.connect() function, followed by a mandatory 500ms stabilization period.
  4. The agent sends specific hex protocols (e.g., A0 01 01 A2 for ON) to the relay to change its physical state.
  5. The session state is tracked in memory to maintain an accurate representation of the relay status.
  6. Upon completion of the task, the serial port is explicitly released via relay.disconnect() to prevent resource locking within the Openclaw Skills environment.

Control USB Relay Setup

Before using this skill within Openclaw Skills, ensure your Linux environment is properly configured for serial access.

# Install Python 3 if not already present
sudo apt update && sudo apt install python3

# Add your user to the dialout group to permit serial port access
sudo usermod -a -G dialout $USER

# Verify the relay is detected at the expected endpoint
ls /dev/ttyUSB*

Note: You may need to restart your session or reboot for group permission changes to take effect.

Control USB Relay Data Schema & Taxonomy

The skill manages hardware interactions using a non-persistent, session-based approach to data tracking.

Attribute Type Description
Endpoint String The hardware path, default is /dev/ttyUSB1
State Boolean Current ON/OFF status tracked in-memory
Protocols Hex Codes Predefined command strings for different relay modules
Dependencies Binary Requires python3 and linux-specific serial drivers

Control USB Relay Advanced Features

  • Support for custom hex protocols to maintain compatibility with diverse relay hardware modules.
  • In-memory state synchronization to prevent unnecessary repeat commands to the hardware.
  • Automated resource cleanup ensures the serial port is always released for other Openclaw Skills.
  • Low-latency initialization logic designed for high-performance automation sequences.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*