Next: How Plugins Fit In, Previous: Component Roles, Up: Concepts [Contents]
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:
<bind … input="..."/>.
<bind … output="..."/> → datapoint → writer → transport.
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.
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.
process-transport or
http-transport) that fetches that payload on a schedule.
json-reader (or stream-reader) into a
datapoint, optionally through text-to-value type="date" to obtain
day-minutes.
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.
The lamp is the actuator. It usually needs both directions:
STOutput (e.g. KitEastLight:switch)
bound to a command datapoint, a stream-writer that turns
0/1 into false/true, and an
http-transport with write-target=url that calls the device
RPC.
json-reader into a feedback datapoint bound to the
same output with role="feedback".
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.
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.
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.
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]