Previous: Inputs, Outputs, and Bindings, Up: Configuration Reference [Contents]
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).
Use http-transport with an https:// <url>
(see http-transport).
<auth type="header"><token>…</token></auth>.
<auth type="basic"> with <username> / <password>.
<cookie-jar> path. Put
<auth type="form"> with <login-url> (and body or
username/password) on the transports that need the session. Optional
<relogin-on-status>401,403</relogin-on-status> retries login when
the server rejects the cookie.
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.
Choose the transport that matches the protocol:
adapter-transport stays connected and reconnects with backoff
(see adapter-transport). Use separate read and write
transports (each claims its own connection to the same
address:port).
tuya-direct / tuya-gateway keep a TCP socket,
heartbeat, and optional status refresh
(see tuya-direct). Share one socket between
read and write with the same <socket-group>.
<poll-cron> (and form-auth cookie jars) so the service chats on
your timetable.
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.
http-transport (GET + poll-cron) → json-reader (path maps) → datapoint [+ formula / sampling] → bind input=
See examples/space-track/ and examples/shelly-ht/.
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).
Use stream-reader / stream-writer with
encoding="hex" (and offset/length maps), not JSON plugins
(see stream-reader, stream-writer).
Stack transforms on the datapoint (see Datapoints and Transforms):
formula-transform for #/10, clamps, rounding
(see formula-transform).
sampling-transform with mode=sliding for a moving
average, or mode=hold so a new average appears only every
N samples / time bucket (see sampling-transform).
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>.
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.
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.
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]