Local TCP Ingestion

Push station data directly to the local Autumn Labs client over TCP.

The Autumn Labs SDK normally formats and sends station data for you. For advanced integrations, you can send the same event format directly to the local Autumn Labs client over TCP.

Use this path when an application runs on the station PC but cannot use an Autumn Labs SDK. The local client listens on loopback only:

text
127.0.0.1:5700

Local TCP ingestion is preferred for station-side integrations because the Autumn Labs client can use its normal buffering and retry behavior when the network is unavailable.

Get the station ID

The event payload requires the registered station ID in the sid field. Run al info --verbose; the station ID is printed as stationID=<value>.

bash
al info --verbose

Example output:

text
stationID=stn_abc123

You can capture it in a shell variable:

bash
STATION_ID="$(al info --verbose | sed -n 's/^stationID=//p' | head -n 1)"
powershell
$StationId = (al info --verbose | Select-String '^stationID=' | Select-Object -First 1).Line -replace '^stationID=', ''

If STATION_ID is empty, confirm the station has been registered and the Autumn Labs client is installed on the machine sending data.

TCP message envelope

Write one JSON object per TCP message. End each message with a newline character (\n) so the local client can frame the JSON event.

json
{
  "source_type": "sdk",
  "file": "metrics",
  "station_id": "stn_abc123",
  "message": "{\"sid\":\"stn_abc123\",\"slt\":\"\",\"ser\":\"UNIT-123\",\"utc\":1778702400000000,\"mod\":\"production\",\"tag\":[\"manual\"],\"nam\":\"temperature\",\"met\":{\"value\":25.5,\"unit\":\"C\",\"type\":\"float\"},\"lim\":{\"upper\":30,\"lower\":20},\"rea\":\"\",\"res\":\"pass\"}"
}
FieldTypeDescription
source_typestringUse sdk for local TCP ingestion.
filestringEvent family. Use logs, metrics, states, or units.
station_idstringRegistered station ID. This should match the payload sid.
messagestringA JSON-encoded string containing the event payload.

message must be a string, not a nested JSON object. Build the event payload first, serialize it to JSON, then place that string in the message field.

Common fields

Every event payload uses the same compact field names as the SDK.

FieldTypeDescription
sidstringStation ID. Run al info --verbose and use the value printed as stationID=<value>.
sltstringOptional station slot. Use an empty string when not applicable.
serstringOptional unit serial number. Use an empty string for station-level events.
utcintegerEvent timestamp as Unix microseconds.
locstringOptional local UTC offset, for example -07:00. Omit it unless your integration needs to preserve the station's local offset.
modstringOptional station mode.
tagstring arrayOptional tags. Use an empty array when not applicable.

Send a metric

bash
STATION_ID="$(al info --verbose | sed -n 's/^stationID=//p' | head -n 1)"
UTC_MICROS="$(($(date +%s) * 1000000))"

EVENT=$(
  jq -nc \
    --arg sid "$STATION_ID" \
    --argjson utc "$UTC_MICROS" \
    '{
      sid: $sid,
      slt: "",
      ser: "UNIT-123",
      utc: $utc,
      mod: "production",
      tag: ["manual", "tcp"],
      nam: "temperature",
      met: {value: 25.5, unit: "C", type: "float"},
      lim: {upper: 30, lower: 20},
      rea: "",
      res: "pass"
    }'
)

MESSAGE=$(
  jq -nc \
    --arg station_id "$STATION_ID" \
    --arg message "$EVENT" \
    '{source_type:"sdk", file:"metrics", station_id:$station_id, message:$message}'
)

printf '%s\n' "$MESSAGE" | nc 127.0.0.1 5700
powershell
$StationId = (al info --verbose | Select-String '^stationID=' | Select-Object -First 1).Line -replace '^stationID=', ''
$UtcMicros = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() * 1000

$Event = @{
  sid = $StationId
  slt = ""
  ser = "UNIT-123"
  utc = $UtcMicros
  mod = "production"
  tag = @("manual", "tcp")
  nam = "temperature"
  met = @{
    value = 25.5
    unit = "C"
    type = "float"
  }
  lim = @{
    upper = 30
    lower = 20
  }
  rea = ""
  res = "pass"
} | ConvertTo-Json -Depth 10 -Compress

$Envelope = @{
  source_type = "sdk"
  file = "metrics"
  station_id = $StationId
  message = $Event
} | ConvertTo-Json -Depth 10 -Compress

$Client = [System.Net.Sockets.TcpClient]::new("127.0.0.1", 5700)
$Writer = [System.IO.StreamWriter]::new($Client.GetStream())
$Writer.WriteLine($Envelope)
$Writer.Flush()
$Writer.Dispose()
$Client.Dispose()

Metric payload fields:

FieldTypeDescription
namstringMetric name.
met.valueanyMetric value.
met.unitstringOptional unit, for example C, mm, or ms.
met.typestringValue type: string, integer, float, boolean, or array.
lim.upperanyOptional upper limit. Use null when not applicable.
lim.loweranyOptional lower limit. Use null when not applicable.
reastringOptional result reason.
resstringOptional result, for example pass or fail.

Send a log

Create the event payload with log-specific fields, then wrap it in the same TCP envelope with file: "logs".

json
{
  "sid": "stn_abc123",
  "slt": "",
  "ser": "UNIT-123",
  "utc": 1778702400000000,
  "mod": "production",
  "tag": ["manual"],
  "nam": "operator.note",
  "log": "Started inspection",
  "lvl": "info"
}

Log payload fields:

FieldTypeDescription
namstringOptional log name or category.
logstringLog message.
lvlstringLog level: trace, debug, info, warn, error, fatal, or panic.

Send a station state

Create the event payload with state-specific fields, then wrap it in the same TCP envelope with file: "states".

json
{
  "sid": "stn_abc123",
  "slt": "",
  "ser": "",
  "utc": 1778702400000000,
  "mod": "production",
  "tag": ["manual"],
  "nam": "active",
  "dsc": "Station is processing units"
}

State payload fields:

FieldTypeDescription
namstringState name, for example active, idle, or maintenance.
dscstringOptional state description.

Send a unit event

Create the event payload with unit-specific fields, then wrap it in the same TCP envelope with file: "units".

json
{
  "sid": "stn_abc123",
  "slt": "slot-1",
  "ser": "UNIT-123",
  "utc": 1778702400000000,
  "mod": "production",
  "tag": ["manual"],
  "typ": "",
  "dir": "input",
  "res": "",
  "met": null
}

Unit payload fields:

FieldTypeDescription
typstringOptional unit type.
dirstringUse input when a unit enters the station and output when it leaves.
resstringOptional unit result, usually used on output events.
metobject or nullOptional unit metadata.

Cloud HTTP fallback

For integrations that cannot run on the station PC, send the same envelope over HTTPS to the Autumn Labs cloud ingestion endpoint:

text
POST https://client.autumnlabs.io/api/v0/ingest

Cloud HTTP ingestion requires the ingest credentials configured for the station. Prefer the local TCP path when the integration is running on the station PC.