Next: , Previous: , Up: Concepts   [Contents]


1.3 Thinking in Pipelines

STCS is not where you write automation logic. That belongs in starter-core rules. This service is a bridge: you shape each external signal as a short pipeline that ends on an STInput or starts from an STOutput.

Ask three questions for every device or feed:

  1. What should enter STARTER? A temperature, a clock, a switch state—anything the rules might read. That wants a read pipeline: transport → reader → datapoint → <bind … input="..."/>.
  2. What should leave STARTER? A setpoint, a relay command—anything the rules might write. That wants a write pipeline: <bind … output="..."/> → datapoint → writer → transport.
  3. Does the device report its own state? If yes, add a feedback datapoint on the same output (role="feedback") so STCS can mirror the field and detect manual overrides (see Command and Feedback).

Numeric cosmetics (unit conversion, rounding, averaging) stay on datapoint transforms. Decisions such as “turn the light on after sunset” stay in the core rules file.

Example: Time as an input

Suppose you want rules that depend on the time of day (for example minutes since midnight). Time is not a lamp—it is a sensor for the automation brain.

  1. Choose a source: a small helper that prints JSON, an HTTP clock API, or a file updated by cron.
  2. Configure a read transport (process-transport or http-transport) that fetches that payload on a schedule.
  3. Map the field with json-reader (or stream-reader) into a datapoint, optionally through text-to-value type="date" to obtain day-minutes.
  4. Bind the datapoint to an STInput, e.g. CLK:DayMinutes.

From there, starter-core sees a normal input. A rule can compare it to sunset, a schedule, or another service—without STCS knowing anything about lamps.

Example: A light switched by those rules

The lamp is the actuator. It usually needs both directions:

The “if time past sunset then light on” logic lives in the core. This service only keeps the output aligned with the physical switch and pushes commands when the core (or a peer) changes the value.

Example: Sensor only

An outdoor temperature from a JSON API is a one-way story: poll with http-transport, parse with json-reader, optional formula-transform / sampling-transform, bind to an input. No writer, no output.

Example: Setpoint only (with optional echo)

A boiler flow setpoint is primarily a write pipeline. If the cloud or device also returns the current setpoint, add a feedback map so the STOutput does not drift from reality and so a change made on the boiler panel can raise MANUAL_OVERRIDE.

A practical sketch

Want: rules use time + drive a Shelly switch

STCS config:
  [read]  process/http ``now''
          → json-reader → DayMinutes → INPUT
  [read]  http GetStatus → json-reader
          → switch-fb → OUTPUT (feedback)
  [write] OUTPUT (command)
          → stream-writer → http Switch.Set

starter-core rules:
  when DayMinutes crosses threshold
    → set KitEastLight:switch

Draw the arrows on paper before editing XML. If a value is consumed by rules, it must become an input. If a value is produced by rules, it must become an output—and if the hardware talks back, give that output a feedback path.


Next: How Plugins Fit In, Previous: Component Roles, Up: Concepts   [Contents]