USB Relay Module
This page documents the low-level relay control module in hid_usb_relay.
The module provides:
RelayRuntime— executable discovery and command executionUSBRelayDevice— control a specific relay deviceRelayService— service layer for relay operationsenumerate_devices()— list connected HID USB relay boardsRelayState,RelayError, and validation helpers
Core domain and process layer for HID USB relay control.
This module provides a small object model around the vendor CLI binary and normalizes command execution, relay validation, and output parsing.
RelayCommand
Bases: Enum
CLI actions exposed by the vendor executable.
RelayCommandError
Bases: RelayError
Raised when command execution fails.
RelayConfig(default_timeout=5.0, max_relay_count=8, relay_cmd=None)
dataclass
Shared runtime constants for relay interactions.
RelayError
Bases: Exception
Base relay exception.
RelayResult(relay_state)
dataclass
Service return payload for relay operations.
RelayRuntime(base_path=None, timeout=CONFIG.default_timeout)
Encapsulates executable discovery and subprocess execution.
Source code in src\hid_usb_relay\usb_relay.py
79 80 81 | |
RelayService
Application service used by API/CLI/GUI layers.
RelayState
Bases: Enum
Supported relay state transitions.
RelayValidationError
Bases: RelayError
Raised when relay input values are invalid.
USBRelayDevice(device_id=None, runtime=RUNTIME)
Device wrapper used for state reads and writes.
Source code in src\hid_usb_relay\usb_relay.py
186 187 188 | |
enumerate_devices()
Enumerate connected relay devices and their current states.
Source code in src\hid_usb_relay\usb_relay.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
get_bin_directory(base_path=None)
Return the binary directory for a given package base path.
Source code in src\hid_usb_relay\usb_relay.py
125 126 127 128 | |
get_executable_path(base_path=None)
Return the platform-specific relay executable path.
Source code in src\hid_usb_relay\usb_relay.py
131 132 133 134 | |
get_platform_info()
Return normalized host platform metadata.
Source code in src\hid_usb_relay\usb_relay.py
137 138 139 140 | |