TofuPilotTofuPilot

Station

Deploy test stations with controlled access and monitoring.

Station header

Overview

A Station represents a physical test bench that executes procedures. Each station has its own API key and links to specific procedures for controlled access across production sites.

Create Stations

Create a station in the Stations tab. Enter a name and generate an API key.

Link procedures to the station using Link Procedure.

Use the generated station API key in your TofuPilot client by passing it as the api_key argument in your script or by storing it in your environment variables.

with TofuPilot(test, api_key="YOUR_STATION_API_KEY"):
  test.execute(lambda: "SN001")
client = TofuPilotClient(api_key="YOUR_STATION_API_KEY")

Link relevant procedures to the station.

In your script, ensure you use the procedure_id linked to your station when pushing test runs to TofuPilot.

test = htf.Test(procedure_id="FVT1")
client.create_run(procedure_id="FVT1")

Required Parameters

All stations require these fields:

PropTypeDefault
procedure_id?
str
api_key?
str
# Before running the script, ensure you have created a station in the TofuPilot interface
# and linked it to the specified procedure ID ("FVT1" in this example).
# You also need to save your API key in an environment variable named "STATION_API_KEY"
# or pass it directly as an argument like this:
# TofuPilot(test, api_key="STATION_API_KEY")


import openhtf as htf
from tofupilot.openhtf import TofuPilot


def phase_one(test):
  return htf.PhaseResult.CONTINUE


def main():
  test = htf.Test(
      phase_one,
      procedure_id="FVT1",  # Create a station in TofuPilot linked to this procedure ID
      part_number="PCBA01",
  )

  # The API key can be set in environment variables or passed directly.
  with TofuPilot(test):
      test.execute(lambda: "SN-0001")


if __name__ == "__main__":
  main()
# Before running the script, ensure you have created a station in the TofuPilot interface
# and linked it to the specified procedure ID ("FVT1" in this example).
# You also need to save your API key in an environment variable named "STATION_API_KEY"
# or pass it directly as an argument like this:
# TofuPilotClient(api_key="STATION_API_KEY")

from datetime import datetime, timedelta

from tofupilot import PhaseOutcome, TofuPilotClient


def phase_one():
  start_time_millis = datetime.now().timestamp() * 1000
  phase = {
      "name": "phase_one",
      "outcome": PhaseOutcome.PASS,
      "start_time_millis": start_time_millis,
      "end_time_millis": start_time_millis + 30 * 1000,  # 30 seconds
  }
  return phase


def main():
  # The API key can be set in environment variables or passed directly.
  client = TofuPilotClient()

  client.create_run(
      procedure_id="FVT1",  # Create a station in TofuPilot linked to this procedure ID
      run_passed=all(
          phase["outcome"] == PhaseOutcome.PASS for phase in phases),
      unit_under_test={
          "serial_number": "SN-0001",
          "part_number": "PCBA01"
      },
      phases=[phase_one()],
      duration=timedelta(minutes=1, seconds=45),
  )


if __name__ == "__main__":
  main()

API Key

Each station gets a unique API key with limited permissions compared to user API keys. Regenerate or delete keys if compromised or when stations are decommissioned.

Station API key management

Stations can link to one or multiple procedures. Use Link Procedure to modify these connections.

Station procedure linking

Access Operator UI

Access each station's Operator UI from the Stations tab. Available for OpenHTF stations only.

Station list

Monitor Uptime

Track station connectivity and uptime. Real-time status and 90-day uptime history available for OpenHTF stations.

Station header

How is this guide?