Previous: , Up: Configuration Reference   [Contents]


6.9 Configuration Tips

Each tip names a common goal and the usual plugin combination. Details for every option are in the sections above. Remember the hard rule: one transport is claimed by at most one reader or one writer (see Component Roles).

HTTPS API with authentication

Use http-transport with an https:// <url> (see http-transport).

Poll with GET + <poll-cron>, parse with json-reader, bind to an input. For a POST that carries a body, use a write transport (method POST/PUT, no poll) and a writer.

Keep talking to a remote peer continuously

Choose the transport that matches the protocol:

Run an external helper on a schedule

process-transport is oneshot: it execs, captures stdout (read) or feeds stdin (write), waits for exit, then stops (see process-transport). It does not keep a child daemon forever.

If you want fresh data every minute, add <poll-cron> on a read transport (as in examples/current-time/). If you need a long-lived process, run it under systemd/supervisord and have STCS talk to it over HTTP, a file drop, or an adapter—not via a single never-exiting process-transport.

JSON cloud or device status into STARTER

http-transport (GET + poll-cron)
  → json-reader (path maps)
  → datapoint [+ formula / sampling]
  → bind input=

See examples/space-track/ and examples/shelly-ht/.

Drive a device URL or RPC from an output

bind output= (command)
  → datapoint → stream-writer or json-writer
  → http-transport (POST/PUT, or write-target=url)

For Shelly-style Switch.Set?on={{payload}}, set <write-target>url</write-target> and put {{payload}} in <url>. Pair with a second read pipeline and role="feedback" when the device reports state (see Command and Feedback).

Binary or fixed-layout payloads

Use stream-reader / stream-writer with encoding="hex" (and offset/length maps), not JSON plugins (see stream-reader, stream-writer).

Round, scale, or average noisy values

Stack transforms on the datapoint (see Datapoints and Transforms):

Enumerations and timestamps in text

On a reader map, add <text-to-value type="map"> to turn "off"/"on" into 0/1, or type="date" for clock fields (see Text Conversions). Writers use the inverse <value-to-text>.

Drop-folder or file snapshot

file-transport in read mode with <poll-cron> re-reads a path; write/append for outbound files (see file-transport). Combine with json-reader or stream-reader like any other transport.

Complex vendor protocol already in an adapter

Run starter-configurable-adapter with its plugin, then in STCS use adapter-transport + json-reader / json-writer (see adapter-transport). Keep the protocol out of STCS XML.

Retries when a write fails

On the writer, set <write-attempts> and optional <write-retry-backoff> (see Writers). The base writer re-sends the same bytes; the transport only reports success or error.


Previous: Inputs, Outputs, and Bindings, Up: Configuration Reference   [Contents]