Services

async OPNsenseClient.get_services()

Return all manageable OPNsense services.

Returns:

Service rows from the core service search

endpoint with a derived boolean status field indicating whether each service is currently running.

Return type:

list[dict[str, Any]]

async OPNsenseClient.get_service_is_running(service)

Return whether a named OPNsense service is running.

Parameters:

service (str) – Service name or service id as reported by OPNsense.

Returns:

True when the service exists and is running; False

when it is stopped, unavailable, or cannot be found.

Return type:

bool

async OPNsenseClient.start_service(service)

Start an OPNsense service.

Parameters:

service (str) – Service name as reported by OPNsense.

Returns:

True when the operation succeeds; otherwise, False.

Return type:

bool

async OPNsenseClient.stop_service(service)

Stop an OPNsense service.

Parameters:

service (str) – Service name as reported by OPNsense.

Returns:

True when the operation succeeds; otherwise, False.

Return type:

bool

async OPNsenseClient.restart_service(service)

Restart an OPNsense service.

Parameters:

service (str) – Service name as reported by OPNsense.

Returns:

True when the operation succeeds; otherwise, False.

Return type:

bool

async OPNsenseClient.restart_service_if_running(service)

Restart an OPNsense service only when it is currently running.

Parameters:

service (str) – Service name as reported by OPNsense.

Returns:

True when the operation succeeds; otherwise, False.

Return type:

bool