Skip to content

examples/sila: a Nano served as a SiLA 2 device, one field of each kind - #25

Merged
neu-rah merged 2 commits into
mainfrom
examples-sila
Oct 8, 2026
Merged

neu-rah merged 2 commits into
mainfrom
examples-sila

Conversation

@neu-rah

@neu-rah neu-rah commented Oct 8, 2026

Copy link
Copy Markdown
Member

A new example: one machine of eight roles, served as SiLA 2 features by a Python gateway, from a Nano or from a host build with simulated endpoints.

  • Roles: switch, bounded level, discrete set, action, labelled select, analog in volts, text, and a command in presented units (a percentage, rounded to the nearest raw value, the device's actual value reported back).
  • `gateway.py` knows only the kinds in its table (`KINDS`) and the unit symbols in `UNITS` (`V`, `%`); anything else, a tuned role, or a stray description line is refused by name at start. Feature definitions are generated at start, never committed. The server UUID is derived from the originator (`io.github.internetofpins`) and the machine hash.
  • The six kinds that are not in `role/kinds.h` (discrete, action, select, analog, text, scaled) are in `examples/sila/src/kinds.h`; they move into the library when a second machine needs them. The gateway stays in the example until a second example needs it.
  • `README.md`: wiring, build, flash, serve, run without a board (`--sim`), the field-to-SiLA-type table, the rules a user meets, expected output from a real Nano run, what is not covered. `README.md` (root) lists the example; `docs/role.md` links it.

Verified on a Nano (ATmega328P, avr-gcc 7.3.0): 8910 B flash / 345 B RAM; the SiLA checks (constraints, subscriptions, refusals, rounding edge cases, concurrency) pass with a separate client implementation (`unitelabs-sila`) and the XSD of `sila_base`; the host build and README steps work from a clean clone.

Two commits on top of `main` (the `value`/`scale`/`unit` lines and `%` landed in #24).

🤖 Generated with Claude Code

neu-rah and others added 2 commits October 8, 2026 16:46
Eight roles (switch, bounded level, discrete set, action, labelled select, analog in volts, text, command in presented units) from a Nano or from
a host build with simulated endpoints, served as SiLA 2 features by gateway.py, which knows only the kinds in its table and refuses the rest by
name. The six kinds that are not in role/kinds.h are in src/kinds.h. The feature definitions are generated at start; the server UUID is derived from
the originator and the machine hash.

Moved from R&D/OneMachine/silaCompose @ f158e21 (minimal/). The firmware image built here is byte-identical to the one built there (avr-gcc 7.3.0:
8910 B flash, 345 B RAM, sha256 97f1f9ea31a4c1a35f3a0ad1c904d5ecfdeaac60e0aa160fa16eb2de0885614e). Needs describe-values (value/scale/unit lines,
'%' in a unit symbol).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@neu-rah
neu-rah merged commit cfbaacd into main Oct 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant