Last updated

Run a maintenance procedure

Maintenance procedures are interactive. The Prep drives the procedure and pushes each prompt to your application over the events WebSocket; your application answers each prompt with a REST call. This recipe walks through the full loop: list the procedures, start one, subscribe to the events WebSocket, dispatch on the event code, and acknowledge each prompt.

Daily and Weekly maintenance include physical operator tasks such as removing labware, wiping the deck, and replacing O-rings. These procedures are interactive by design and are not intended to run unattended. Data Maintenance and Database Backup require no operator interaction and only need the start request.

All REST requests on this page require a bearer token. (Go to Authentication for more information.) The WebSocket handshake itself does not carry the token.

Retrieve the list of maintenance procedures

Each procedure has an id that is required to start it. Retrieve the list first and select the procedure you want to run.

The id field is the procedure identifier used in the start request.

The name field is the display name of the procedure, such as Daily Maintenance

The status field indicates whether the procedure is current or overdue.

The lastExecutionTime field is the last time the procedure completed.

get/api/v2/maintenance
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance' \
  --header 'Authorization: Bearer <token>'
Response
Get procedures was successful

Connect to the events WebSocket

Maintenance prompts are delivered over the events WebSocket. Connect before starting the procedure so that no prompt is missed.

ws://[IP_address]/NimbusLite/instinctevents

Replace [IP_address] with the IP address of the Prep.

Go to Connect to real-time events for connection examples in JavaScript, Python, and C#, and for the event message format.

The data field of every event is a JSON-encoded string, not a nested object. Parse it a second time to reach the payload. The dialog id required by close-view is inside that inner payload and never appears at the top level.

Event codes are emitted in lowercase. Lowercase the code value before comparing it.

Start the maintenance procedure

Start the procedure using the id from the procedure list. The request returns as soon as the procedure has been started, and all further interaction happens over the WebSocket.

The instrument may need to initialize. Close the door before starting the procedure.

post/api/v2/maintenance/{id}
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance/<id>' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Post procedure was successful

Handle the maintenance events

The following event codes are relevant to a maintenance run.

Code

Definition

Response Required

maintenancedata

A maintenance step or screen prompt.

Acknowledge with close-view.

messagebox

A modal message box.

Acknowledge with close-view.

timeremaining

Countdown tick for a timed step.

None

finished

The procedure has completed and the system is idle.

None

generic

A mirror of every underlying instrument event.

None (typically)

maintenancedata

This is the primary event of a maintenance run. The parsed data payload has the following shape:

json
{ 
  "id": "5854c6bfedba41cba94560861b0075d8",
  "textSections": [["Remove all labware from the deck.", null, null], [null, null, null], [null, null, null]],
  "imageName": "DailyMaint_RemoveLabware",
  "buttonText": "Next",
  "selectionCaptions": null,
  "selectionImages": null,
  "spinnerShown": false,
  "inputType": null,
  "labwarePosition": 0
}

The id field is the value to send as viewId when acknowledging the prompt.

The textSections field is a 3x3 array of instruction text. Empty positions are null.

The imageName field is the illustration to display, or null. It may contain more than one name separated by commas. Retrieve each image with the maintenance image endpoint.

The buttonText field is the caption of the Continue button, such as Next.

The selectionCaptions field is present when the prompt asks the operator to pick one of several options. It is null otherwise.

The selectionImages field holds the image name for each selection, in the same order as selectionCaptions.

The spinnerShown field indicates the instrument is busy. When it is true, display a progress indicator and do not enable the Continue button.

The inputType field identifies prompts that require something other than a simple acknowledgement. A value of yesno indicates a Yes/No prompt.

A maintenancedata event whose id is the literal value finishMessage isn't a prompt. It carries the closing summary text for the routine in textSections[0][0]. Display it, but don't send close-view for it.

messagebox

json
{
  "id": "9f2c8d5b1a0e4c7f8b3d6a2e5c1f0b4d",
  "message": "The waste container is full.",
  "title": "Attention",
  "icon": "warning"
}

Display the message and acknowledge it with viewResult set to Ok once the operator dismisses it.

timeremaining

json
{ 
  "runStartTime": "2026-07-28T09:14:02.113Z",
  "runCurrentTime": "2026-07-28T09:18:44.220Z",
  "runEstimatedEndTime": "2026-07-28T09:45:00.000Z",
  "pauseSeconds": 0
}

Use these values to drive a countdown during timed steps such as UV decontamination. No response is required.

finished

The finished event is sent when the procedure completes and the system returns to idle. Its data field is an empty string. Treat this as the end of the run and stop waiting for further prompts.

generic

A generic event is emitted for every inbound instrument event, so expect high volume. Two cases matter during maintenance.

When Payload is the string aborted, the procedure has been aborted and no further prompts will arrive. When it is paused, pause any countdown you are displaying.

When Payload parses as JSON and contains a NewState of Handling or AutoHandled, a prompt your application is currently displaying has been resolved elsewhere. Match it by the Id field, stop displaying it, and do not send close-view for it.

The Payload field is sometimes a bare string and sometimes a JSON object. Wrap the second parse in a try/catch and fall back to string comparison. Go to Connect to real-time events for the full generic payload.

Respond to a prompt

Answer a prompt by posting the dialog id back to the close-view endpoint.

The viewId field is the id from the parsed data payload of the event.

The viewResult field is the response. It is parsed as an enum and is case-insensitive. Valid values are None, Timeout, Automatic, RunAborted, Ok, Cancel, Yes, No, Abort, Retry, and Ignore. In practice, a maintenance client only needs Ok, Yes, No, Cancel, and Abort. Any other value returns 400 with a message listing the valid values.

The viewInput field carries additional input for prompts that require it, and is otherwise omitted or null.

post/api/v2/maintenance/close-view
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance/close-view' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "viewId": "string",
  "viewResult": "string",
  "viewInput": "string"
}'
Response
Close view was successful

The following table shows three prompt shapes that are acknowledged differently:

Prompt

How to Detect It

viewResult

viewInput

Continue

Default case

Ok

None

Yes/No

inputType is yesno

Yes or No

None

Pick one

selectionCaptions is a non-null array

Ok

The zero-based index of the selected entry, as a string

For a pick-one prompt, send the index of the selection rather than its caption text. For example, choosing the second entry of selectionCaptions sends 1 as viewInput.

A close-view request for a dialog that has already been closed returns 400. This happens when the acknowledgement races an automatically resolved dialog. Log it and continue processing events rather than treating it as a fatal error.

Retrieve the instruction images

The imageName value from a maintenancedata event is a file name without an extension. Request the image to display it alongside the instruction text. When imageName contains multiple comma-separated names, request each one.

get/api/v2/maintenance/images/{imageName}
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance/images/<imageName>' \
  --header 'Authorization: Bearer <token>'
Response
File stream of image

Review errors after the run

After the finished event, retrieve the errors that occurred during the procedure. An empty list means the procedure completed without errors.

The message field is the error that was raised.

The response field is the resolution that was applied.

get/api/v2/maintenance/errors
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance/errors' \
  --header 'Authorization: Bearer <token>'
Response
List of errors

Abort a running procedure

Abort the running procedure at any time. The run ends with a generic event whose Payload is aborted, followed by the normal end-of-run handling.

post/api/v2/maintenance/abort
curl 'http://{{your_prep_ip_address}}/api/v2/maintenance/abort' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Abort procedure was successful

Complete example

JavaScript

javascript
const host = '[IP_address]';
const token = '[bearer_token]';

	
async function closeView(viewId, viewResult, viewInput = null) {
  const response = await fetch(`http://${host}/NimbusLite/api/v1/maintenance/close-view`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify({ viewId, viewResult, viewInput })
  });

	
  if (!response.ok) {
    // A 400 usually means the dialog was already closed. Keep processing events.
    console.warn('close-view failed:', await response.text());

	
  }
}

	
const ws = new WebSocket(`ws://${host}/NimbusLite/instinctevents`);

	
ws.onopen = () => console.log('Connected to instinctevents');

	
ws.onmessage = async (message) => {
  const event = JSON.parse(message.data);

	
  switch (event.code.toLowerCase()) {
    case 'maintenancedata': {
      const prompt = JSON.parse(event.data);

	
      // Closing summary, not a prompt.
      if (prompt.id === 'finishMessage') {
        console.log('Summary:', prompt.textSections[0][0]);
        break;
      }

	
      // The instrument is busy. Wait for the next event.
      if (prompt.spinnerShown) {
        break;
      }

	
      console.log(prompt.textSections[0][0]);

	
      if (prompt.inputType === 'yesno') {
        await closeView(prompt.id, 'Yes');
      } else if (prompt.selectionCaptions) {
        // Send the zero-based index of the choice, as a string.
        await closeView(prompt.id, 'Ok', '0');
      } else {
        await closeView(prompt.id, 'Ok');
      }
      break;
    }

	
    case 'messagebox': {
      const box = JSON.parse(event.data);
      console.log(`${box.title}: ${box.message}`);
      await closeView(box.id, 'Ok');
      break;
    }

	
    case 'timeremaining': {
      const time = JSON.parse(event.data);
      console.log('Estimated end:', time.runEstimatedEndTime);
      break;
    }

	
    case 'finished':
      console.log('Maintenance complete');
      ws.close();
      break;

	
    case 'generic':
      // High volume. Handle only what you need.
      break;
  }
};

	
ws.onerror = (error) => console.error('WebSocket error:', error);
ws.onclose = () => console.log('Disconnected from instinctevents');

Python

python
import json
import requests
import websocket


HOST = "[IP_address]"
TOKEN = "[bearer_token]"
BASE_URL = f"http://{HOST}/NimbusLite/api/v1"




def close_view(view_id, view_result, view_input=None):
    response = requests.post(
        f"{BASE_URL}/maintenance/close-view",
        headers={"Authorization": f"Bearer {TOKEN}"},
        json={"viewId": view_id, "viewResult": view_result, "viewInput": view_input},
        timeout=30,
    )
    if not response.ok:
        # A 400 usually means the dialog was already closed. Keep processing events.
        print("close-view failed:", response.text)




def on_message(ws, message):
    event = json.loads(message)
    code = event["code"].lower()


    if code == "maintenancedata":
        prompt = json.loads(event["data"])


        # Closing summary, not a prompt.
        if prompt["id"] == "finishMessage":
            print("Summary:", prompt["textSections"][0][0])
            return


        # The instrument is busy. Wait for the next event.
        if prompt.get("spinnerShown"):
            return
        print(prompt["textSections"][0][0])


        if prompt.get("inputType") == "yesno":
            close_view(prompt["id"], "Yes")
        elif prompt.get("selectionCaptions"):
            # Send the zero-based index of the choice, as a string.
            close_view(prompt["id"], "Ok", "0")
        else:
            close_view(prompt["id"], "Ok")


    elif code == "messagebox":
        box = json.loads(event["data"])
        print(f"{box['title']}: {box['message']}")
        close_view(box["id"], "Ok")


    elif code == "timeremaining":
        time_remaining = json.loads(event["data"])
        print("Estimated end:", time_remaining["runEstimatedEndTime"])


    elif code == "finished":
        print("Maintenance complete")
        ws.close()


    elif code == "generic":
        payload = json.loads(event["data"])
        # Payload is sometimes a bare string and sometimes a JSON object.
        try:
            inner = json.loads(payload["Payload"])
        except (ValueError, TypeError):
            inner = None


        if str(payload["Payload"]).lower() == "aborted":
            print("Maintenance aborted")
        elif inner and str(inner.get("NewState", "")).lower() in ("handling", "autohandled"):
            # A prompt you are displaying was resolved elsewhere. Do not close it.
            print("Dialog resolved externally:", inner.get("Id"))




ws = websocket.WebSocketApp(
    f"ws://{HOST}/NimbusLite/instinctevents",
    on_message=on_message,
)


ws.run_forever()

Considerations

  • Connect to the WebSocket before sending the start request so that early prompts are not missed.

  • The instrument answers some prompts itself and never publishes them. The dialogs with an inputType of resultRequested and channelCountRequested are answered internally, so the sequence of prompts you receive over the WebSocket is shorter than the sequence shown on the touchscreen.

  • Runtime errors are not sent over this socket. Subscribe to ws://[IP_address]/NimbusLite/instincterrors in parallel to detect and resolve them. Go to Error handling for more information.

  • The instinctevents socket also carries protocol run status events. Filter on the event code so that maintenance handling is not affected by protocol activity.

  • Only one procedure runs at a time. Wait for finished before starting another.