Next: , Previous: , Up: STARTER Configurable Service   [Contents]


5 Configuration Examples

This chapter walks through the ready-made XML samples under examples/. They are configuration examples (how to wire shipped plugins), not plugin source code—for that, see Writing Plugins.

The samples below are meant to be read alongside Thinking in Pipelines: most are pure sensor services—data enter STARTER; nothing is commanded. examples/tuya-direct/ also shows a command path.

5.1 SpaceTrack (examples/space-track/space-track.stcs.xml)

What it does

ST:SpaceTrack polls a public HTTP API (https://api.wheretheiss.at/v1/satellites/25544) for the International Space Station (NORAD id 25544) and publishes three starter-core inputs:

There is no <writers> section and no <outputs>: the service only feeds the core. Any rule such as “notify when the ISS is overhead” would live in starter-core, not in this file.

Pipeline sketch

every 15 minutes:
  GET wheretheiss.at JSON
    → json-reader
    → datapoints (round to 0.0001)
    → SPTR:latitude / longitude / altitude

Block by block

<global>

Registers the service as ST:SpaceTrack version 0.1.0 with starter-core / mDNS at runlevel 3.

<transports> — iss-http

http-transport in read mode: GET the satellite URL, Accept: application/json, auth type="none". <poll-cron>0 0 */15 * * *</poll-cron> fires every fifteen minutes on the clock (millisecond and second fields zero).

<datapoints>

Three ids (latitude, longitude, altitude). Each has a formula-transform that rounds to four decimal places (floor(# * 10000 + 0.5) / 10000) so tiny float jitter does not dominate history or rule chatter.

<readers> — iss_json

json-reader bound to iss-http. Three maps copy $.latitude, $.longitude, and $.altitude into the matching datapoints. Values are already numeric in JSON, so no <text-to-value> is required.

<inputs>

Declares the three STInputs with ranges suitable for Earth coordinates and LEO altitude. unit="null" (plain numbers); step="0.0001" matches the transform.

<bindings>

Links each datapoint to its input. That closes the read pipeline: after a successful poll, starter-core peers see updated SPTR:* values.

How to run it

$ starter-configurable-service \
    --config examples/space-track/space-track.stcs.xml

Requires network access to the API. Adjust <poll-cron> if you need a different refresh rate (respect the remote service’s usage expectations).

5.2 Shelly H&T (examples/shelly-ht/shelly-ht.stcs.xml)

What it does

ST:Shelly-HT polls a Shelly Humidity & Temperature device on the local network (Gen1-style /status JSON) and publishes two starter-core inputs:

Again there is no writer and no output: the device is treated only as a pair of sensors. Climate or alert rules belong in starter-core.

Pipeline sketch

every 15 seconds:
  GET http://<device>/status
    → json-reader ($.tmp.value / $.hum.value)
    → datapoints temperature / humidity
    → ShellyHT:temperature / ShellyHT:humidity

Block by block

<global>

Registers ST:Shelly-HT version 0.1.0.

<transports> — status-http

http-transport GET to the device /status URL (placeholder 192.168.1.100—change it to your H&T address), Accept: application/json, no auth. <poll-cron>0 */15 * * * *</poll-cron> runs every fifteen seconds.

<datapoints>

temperature and humidity with no transforms (the device already reports usable floats).

<readers> — status-json

json-reader on status-http. Gen1 Shelly H&T nests the values under $.tmp.value and $.hum.value.

<inputs>

ShellyHT:temperature (-10..50^\circC) and ShellyHT:humidity (0..100 %).

<bindings>

Each datapoint to its input—read pipeline complete.

How to run it

  1. Edit <url> in the config so the host matches your Shelly H&T.
  2. Run:
$ starter-configurable-service \
    --config examples/shelly-ht/shelly-ht.stcs.xml

If your firmware exposes a different JSON layout (e.g. Gen2 Shelly.GetStatus), adjust the path= attributes on the reader maps accordingly.

5.3 Current Time (examples/current-time/)

What it does

ST:Time runs a tiny helper binary (current-time) via process-transport. The helper prints one JSON object with local wall-clock fields and exits. STCS maps selected fields to starter-core inputs:

This is the “time as an input” pattern from Thinking in Pipelines: rules in starter-core can schedule on the clock; STCS only refreshes the numbers.

Helper binary

examples/current-time/current-time.c is built and installed as $(bindir)/current-time. Sample output:

{"year": 2026, "month": 10, "day": 3,
 "hour": 8, "minute": 15, "second": 0,
 "dayMinutes": 495, "daySeconds": 29700,
 "unix": 1759473300,
 "UTCOffset": 7200000000,
 "timezone": "CEST"}

(Exact UTCOffset / timezone depend on the host.)

Pipeline sketch

every minute:
  exec current-time → stdout JSON
    → json-reader
    → datapoints
    → TIME:* inputs

Block by block

<global>

Registers ST:Time version 0.1.0.

<transports> — current-time-process

process-transport in read mode. <command> points at the installed helper (@bindir@/current-time in the .xml.in template, substituted at build time). <user>starter</user> (change if that account is missing), <timeout-ms>1000</timeout-ms>, <poll-cron>0 1 * * * * *</poll-cron> (every minute at second 1).

<datapoints>

Six ids matching the JSON keys we care about (minuteOfDay is fed from dayMinutes).

<readers> — current-time-json

json-reader maps $.year … $.minute and $.dayMinutes → minuteOfDay. Unused helper fields are ignored.

<inputs>

TIME:* with flags="no-history" so minute ticks do not fill the core history database.

<bindings>

Each datapoint to its input.

How to run it

$ ./configure && make && sudo make install
$ starter-configurable-service --config \
  examples/current-time/current-time.stcs.xml

After make install, the same file is also under $(datadir)/starter-configurable-service/examples/current-time/. Ensure <command> matches where the helper binary was installed (or run from a tree where bindir was set accordingly). The process-transport <user> must exist on the host and the service must be allowed to setuid to it.


Next: Configuration Reference, Previous: Configuration Overview, Up: STARTER Configurable Service   [Contents]