Tutorials Getting started
Getting started
From a running install to ISS-near-home → PC beep.
This tutorial walks through a minimal STARTER plant: understand the shape of the system, install the stack, connect real I/O with STCS, write a rule (with m4 macros) that beeps the PC when the International Space Station passes near your house, then inspect the ISS track in MySQL with starter-db.
1. Overview
STARTER is a distributed controller. One or more cores sit at the centre and manage inputs and outputs: they discover peers, apply your rules, and keep history. Around them, many small services import data from the outside world and export commands back out—weather, clocks, relays, adapters, anything you can encode as a number.
That split is intentional. The core does not speak every protocol; the services do. You relate whatever they publish with rules, instead of locking behaviour inside a single device silo.
Everything can run on one host—a small lab box with a core and a few services side by side—or across many hosts on the network. The core discovers peers (for example over mDNS) and connects only those that share its namespace; scale is “add another machine and another service,” not “rewrite the plant.”
How rich the edges are is up to you:
- A simple setup often needs only STCS (
starter-configurable-service): describe pipelines in XML, bridge common devices and APIs to the core. - A more complex plant adds STCA (
starter-configurable-adapter) where STCS is not enough—dedicated plugins, harder protocols, multi-device clouds—while the same core and rules stay in charge.
2. Install
Build and install the packages from source first — see Install from source (Debian-based, Fedora/RHEL-like, Arch, Guix). Prepare MySQL for history and plant data — see Prepare the database. See Download when release tarballs are published.
3. Connect I/O
You will wire two peers the core can discover (same namespace prefix ST: by default):
| Peer | Role | I/O |
|---|---|---|
| STCS SpaceTrack | Poll a public HTTP API for ISS position | Inputs SPTR:latitude, SPTR:longitude, SPTR:altitude |
| beep-example | Local actuator (terminal bell) | Output beep:status |
The core finds them over mDNS; you do not point peers at the core.
3.1 Lab SpaceTrack config
Create the lab directory and save the XML below as ~/starter-lab/space-track.stcs.xml (copy-paste is enough). It is the shipped SpaceTrack example with the poll set to once per minute for the lab; the install tree keeps every 15 minutes for courtesy toward the public API:
/usr/local/share/starter-configurable-service/examples/space-track/space-track.stcs.xml
mkdir -p ~/starter-lab
<?xml version="1.0" encoding="UTF-8"?>
<!--
ST:SpaceTrack — read-only ISS tracker (sensor-only pipeline)
Public API: GET https://api.wheretheiss.at/v1/satellites/25544
(NORAD id 25544 = International Space Station)
Goal: expose ISS latitude, longitude and altitude as starter-core
inputs so rules or other services can consume them. There is no
writer and no ST output — nothing is commanded.
Pipeline (×3 fields):
http-transport (iss-http)
→ json-reader (iss_json)
→ datapoint + formula-transform (round to 0.0001)
→ bind → ST input SPTR:*
Blocks below follow the usual stcs section order.
-->
<stcs version="1">
<!-- Identity published to starter-core / mDNS when runlevel 3 starts. -->
<global>
<service-name>ST:SpaceTrack</service-name>
<service-version>0.1.0</service-version>
</global>
<!--
Read transport: poll the ISS JSON endpoint every minute on the
clock (ms=0, sec=0) for this lab. Stock example uses */15.
No authentication; Accept prefers JSON.
-->
<transports>
<transport id="iss-http" plugin="http-transport">
<url>https://api.wheretheiss.at/v1/satellites/25544</url>
<headers>
<header name="Accept" value="application/json"/>
</headers>
<method>GET</method>
<poll-cron>0 0 * * * * *</poll-cron>
<auth type="none"/>
</transport>
</transports>
<!--
One datapoint per field. formula-transform rounds to four decimal
places (# → VALUE) so noisy floats do not flood history / rules.
-->
<datapoints>
<datapoint id="latitude">
<transform plugin="formula-transform">
<expr>floor(# * 10000 + 0.5) / 10000</expr>
</transform>
</datapoint>
<datapoint id="longitude">
<transform plugin="formula-transform">
<expr>floor(# * 10000 + 0.5) / 10000</expr>
</transform>
</datapoint>
<datapoint id="altitude">
<transform plugin="formula-transform">
<expr>floor(# * 10000 + 0.5) / 10000</expr>
</transform>
</datapoint>
</datapoints>
<!--
Parse the HTTP body once per poll; each JSONPath feeds its datapoint.
Numeric JSON values need no text-to-value.
-->
<readers>
<reader id="iss_json" plugin="json-reader" transport="iss-http">
<map datapoint="latitude" path="$.latitude"/>
<map datapoint="longitude" path="$.longitude"/>
<map datapoint="altitude" path="$.altitude"/>
</reader>
</readers>
<!--
starter-core inputs. unit=null (coordinates / km as plain numbers).
step matches the rounded transform.
-->
<inputs>
<input name="SPTR:latitude" description="ISS latitude"
unit="null" min="-90" max="90" step="0.0001" val="0"/>
<input name="SPTR:longitude" description="ISS longitude"
unit="null" min="-180" max="180" step="0.0001" val="0"/>
<input name="SPTR:altitude" description="ISS altitude (km)"
unit="null" min="0" max="1000" step="0.0001" val="0"/>
</inputs>
<!-- Datapoint → ST input (read path complete). -->
<bindings>
<bind datapoint="latitude" input="SPTR:latitude"/>
<bind datapoint="longitude" input="SPTR:longitude"/>
<bind datapoint="altitude" input="SPTR:altitude"/>
</bindings>
</stcs>
<service-name>ST:SpaceTrack</service-name> matches the default core filter ^(STARTER:|ST:).*. You need outbound HTTPS to api.wheretheiss.at.
3.2 Start core, SpaceTrack, and beep
Open three terminals (DB settings from Prepare the database already applied).
Terminal 1 — core (no plant rules yet):
starter-core
Terminal 2 — STCS:
starter-configurable-service --config ~/starter-lab/space-track.stcs.xml
Terminal 3 — beep (beep-example is a sample peer in the starter-core source tree; it is not installed by make install). From your core build directory:
./examples/beep-example
Leave that terminal open: when beep:status becomes true, the process writes the ASCII bell (\a) about twice per second.
3.3 Confirm with the debugger
In a fourth terminal:
starter-debugger --core=127.0.0.1:17373
After the first SpaceTrack poll, a session looks about like this (addresses/ports and ISS numbers will differ):
Connected to 127.0.0.1:17373
debug-api-version: 3
peers: 2
inputs: 3
outputs: 1
…
(starter) info peers
Peers: 2
ST:Beep 192.168.1.20:45678 READY
ST:SpaceTrack 192.168.1.20:45679 READY
(starter) info io SPTR
Inputs:
SPTR:altitude 421.3124 (ISS altitude (km))
SPTR:latitude 45.1023 (ISS latitude)
SPTR:longitude 11.8741 (ISS longitude)
Outputs: (no match for 'SPTR')
(starter) info io beep
Inputs: (no match for 'beep')
Outputs:
beep:status 0 (local computer beep)
(starter) set output beep:status 1
SetOutput beep:status = 1
(starter) set output beep:status 0
SetOutput beep:status = 0
You want both peers READY, numeric SPTR:* after a successful poll, and beep:status. The poke should ring the terminal that runs beep-example (bell / speakers enabled). If peers never appear, check avahi-daemon and that service names stay under ST: / STARTER: (Install from source troubleshooting).
4. First rule
Intelligence stays in the core: SpaceTrack only publishes numbers; beep only rings. A small rules file decides when the ISS is “near home” using a lat/lon box—and GNU m4 keeps that readable.
m4 is the default rules preprocessor ({F} is replaced by the rules path). Use dnl for m4 comments; lines that are only # … are stripped by m4 before the STARTER lexer sees them.
4.1 Rules file
Create ~/starter-lab/iss-beep.conf. Put your house coordinates in the m4 knobs (degrees). PASS_DEG is a half-width box (~100+ km at mid latitudes for 1.5); widen it (for example 20) to smoke-test without waiting for a real pass.
The file has two layers: m4 (knobs only) then the STARTER rule, written out with comparison and boolean operators (>=, <=, &&, +, -) so the condition stays readable after expansion:
dnl =============================================================================
dnl m4 — begin (preprocessor only; not STARTER syntax)
dnl =============================================================================
define(HOME_LAT, 45.223)dnl your house latitude
define(HOME_LON, 12.000)dnl your house longitude
define(PASS_DEG, 1.5)dnl widen (e.g. 20) for a first test
dnl =============================================================================
dnl m4 — end
dnl =============================================================================
# =============================================================================
# STARTER rules language — begin (what the core parses after m4)
# =============================================================================
beep:status {
SET TRUE WHEN
SPTR:latitude >= (HOME_LAT - PASS_DEG) &&
SPTR:latitude <= (HOME_LAT + PASS_DEG) &&
SPTR:longitude >= (HOME_LON - PASS_DEG) &&
SPTR:longitude <= (HOME_LON + PASS_DEG);
SET FALSE WHEN TRUE;
}
# =============================================================================
# STARTER rules language — end
# =============================================================================
First matching SET wins: when the box matches, beep on; otherwise the catch-all turns it off.
4.2 Reload with the rules file
Stop the bare starter-core from §3 and start it on the lab file (CLI overrides gsettings for this process):
starter-core -R ~/starter-lab/iss-beep.conf
Keep SpaceTrack and beep-example running. In the debugger, info io beep / monitor outputs while SPTR:* updates. For a forced check, temporarily set PASS_DEG huge, restart core, confirm the bell, then restore a tight box.
4.3 What you just proved
- STCS turned a public JSON API into plant inputs—no custom C for that peer.
- Rules + m4 expressed “near my house” without burying geometry inside the service.
- A tiny example peer acted as a safe lab output.
Same pattern scales to relays, valves, and cloud adapters: edges import/export; the core relates them. Leave SpaceTrack running so the Core can accumulate history for the next step.
5. ISS track with starter-db
After the plant has been up for a while (ideally ~24 hours of minute polls), inspect how the ISS moved using starter-db from addons—the plant-level explorer over the same MySQL schema from Prepare the database. No raw SQL: you speak in inputs/outputs and time windows.
Use the same DB credentials you set with gsettings (example password change-me):
starter-db --host 127.0.0.1 --port 3306 \
--user starter --password 'change-me' --database STARTER
You get a starter-db> prompt. Confirm the SpaceTrack labels, then pull latitude and longitude together for the last day (RELATE interleaves them by time; SINCE is UTC):
starter-db> LIST INPUTS MATCHING "SPTR";
starter-db> RELATE INPUT "SPTR:latitude", INPUT "SPTR:longitude"
SINCE "2026-11-14T00:00:00" LAST 40;
Replace the SINCE date with “about 24 hours ago.” LAST 40 caps the rows (history is newest-first). Sample session (rows shortened with …):
starter-db> LIST INPUTS MATCHING "SPTR";
id name description type unit min max step
-- --------------- ------------------ ----- ---- ----- ----- ------
12 SPTR:altitude ISS altitude (km) input null 0 1000 0.0001
13 SPTR:latitude ISS latitude input null -90 90 0.0001
14 SPTR:longitude ISS longitude input null -180 180 0.0001
starter-db> RELATE INPUT "SPTR:latitude", INPUT "SPTR:longitude"
SINCE "2026-11-14T00:00:00" LAST 40;
time kind name value
------------------- ----- --------------- --------
2026-11-15 16:00:01 input SPTR:longitude 12.0412
2026-11-15 16:00:01 input SPTR:latitude 45.2187
2026-11-15 15:59:01 input SPTR:longitude 11.9023
2026-11-15 15:59:01 input SPTR:latitude 45.0914
…
2026-11-15 04:12:01 input SPTR:longitude -8.3310
2026-11-15 04:12:01 input SPTR:latitude 51.2045
…
2026-11-14 00:01:00 input SPTR:longitude 142.5501
2026-11-14 00:01:00 input SPTR:latitude -12.8830
One series alone:
starter-db> READ INPUT "SPTR:altitude" SINCE "2026-11-14" LAST 5;
timestamp name value flags source
------------------- -------------- -------- ----- ------
2026-11-15 16:00:01 SPTR:altitude 421.3124 0 ST:SpaceTrack
2026-11-15 15:59:01 SPTR:altitude 420.9881 0 ST:SpaceTrack
…
2026-11-15 15:56:01 SPTR:altitude 419.7402 0 ST:SpaceTrack
That trail is the same data your rules used for the beep box—history belongs to you; starter-db only reads it. For CSV/JSON export, SET FORMAT csv; (or json) before RELATE / READ. Leave with QUIT;.
6. Next steps
- Read the core and addons Texinfo manuals (see Documentation).
- Browse more tutorials as they are published.
- Ask on the forum.