API Reference

Client Interface

exception hermes_dm.client.connection.HermesError[source]

Bases: Exception

Custom exception raised when the daemon returns an error.

class hermes_dm.client.connection.HermesClient(host='localhost', port=5555, timeout_ms=5000)[source]

Bases: object

Synchronous client for communicating with the Hermes Device Manager daemon.

list_devices()[source]

Get a list of available USB/Serial/Network instrument identifiers.

Return type:

List[str]

list_scpi_resources()[source]

Ask the daemon to scan the local hardware bus and return a list of available PyVISA identifiers (e.g., COM ports, USB, GPIB).

Return type:

List[str]

connect_device(name, identifier, model='auto')[source]

Connect a physical instrument to the daemon. If ‘model’ is omitted or set to ‘auto’, Hermes will attempt to automatically discover the device type and required SCPI terminators.

Return type:

str

configure_device(name, settings)[source]

Apply a dictionary of configuration settings to a specific device.

Return type:

str

set_db_file(filename)[source]

Create or select the SQLite database file for logging.

Return type:

str

start_logging()[source]

Tell the daemon to start continuous polling and logging.

Return type:

str

stop_logging()[source]

Tell the daemon to stop polling instruments.

Return type:

str

set_interval(name, interval)[source]

Set the polling interval (in seconds) for a specific device.

Return type:

str

get_status(name=None)[source]

Get the status of the daemon, or a specific device if ‘name’ is provided.

Return type:

Dict[str, Any]

enable_db_logging(name)[source]

Enable saving this device’s data to the SQLite database. Live telemetry over ZMQ is unaffected.

Return type:

str

disable_db_logging(name)[source]

Stop saving this device’s data to the SQLite database. Live telemetry over ZMQ will continue streaming.

Return type:

str

close()[source]

Cleanly shut down the ZeroMQ socket connection.

Daemon Server

class hermes_dm.daemon.server.PowerSupplyDaemon(db_directory, cmd_port=5555, pub_port=5556)[source]

Bases: object

async start()[source]

Main event loop for the daemon.

async stop()[source]

Cleanly shuts down the daemon, disconnects hardware, and releases network ports.

list_devices(args)[source]
Return type:

dict

async list_scpi_resources(args)[source]
Return type:

dict

async connect_device(args)[source]
Return type:

dict

async disconnect_device(args)[source]
Return type:

dict

async configure_device(args)[source]
Return type:

dict

get_status(args)[source]
Return type:

dict

set_interval(args)[source]
Return type:

dict

set_db_logging(args)[source]
Return type:

dict

set_db_file(args)[source]
Return type:

dict

start_logging(args)[source]
Return type:

dict

stop_logging(args)[source]
Return type:

dict

async handle_command(command, payload)[source]
Return type:

dict

Instrument Drivers

class hermes_dm.instruments.base.BaseInstrument(name, identifier, **kwargs)[source]

Bases: ABC

Base interface for all power supplies and measurement devices.

abstractmethod async connect()[source]

Establish connection to the hardware.

abstractmethod async disconnect()[source]

Safely close the connection.

enable_db_logging()[source]

Enable saving this device’s data to the SQLite database.

disable_db_logging()[source]

Disable saving this device’s data to the SQLite database.

abstractmethod async configure(settings)[source]

Parse dictionary, validate, and apply settings via SCPI.

abstractmethod async read()[source]

Poll the device. Returns a list of tuples: (channel_number, metric_name, value)

Return type:

List[Tuple[int, str, float]]

get_status()[source]

Return the current state and configuration of the device.

Return type:

Dict[str, Any]