Repository navigation
docs: consumers, serving a machine to another protocol - #26
Merged
Merged
Conversation
The rules any consumer follows (a table of kinds, generated self-description, refusal by name, validation at the edge with the device as backstop, holding nothing, a stable identity) and how to add a kind or a consumer, with examples/sila as the worked example. Linked from the README and from role.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… SiLA does "The rules you meet": a value sent straight to the board is clamped by lamp (a light) and ignored by step, mode, note and duty, not ignored by all. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…hing consumer-specific" to a consumer on the other side of the link Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
docs/consumers.md(rules for serving a machine to another protocol), linked from the README (next to the examples list), fromdocs/role.md("The consumer's contract") and fromexamples/sila/README.md.examples/sila/README.md, "The rules you meet": a value that bypasses SiLA was described as ignored by the device in all cases. It is clamped bylamp(alight) and ignored bystep,mode,noteandduty. Checked by running the host build and sending the values straight over the link (python/onemachine, no gateway):lamp.level = 250→{'level': 200, 'clamped': True};step.value = 7(was 50),mode.index = 7(was 2), anotebuffer with bytes0xC3 0xA1(wasbye) andduty.raw = 1001(was 250, max 1000) → the previous value, reported.docs/consumers.md: rule 4 now says thatexamples/silameets it by refusing tuned roles (their run-time values are not served yet); the first sentence of "What the machine provides" is scoped to a consumer on the other side of the link.Every claim in
docs/consumers.md, against the codeexamples/sila/gateway.py:57KINDS: switch, light, discrete, select, analog, text, scaled, actionexamples/sila/src/andplatformio.ini: nosila/grpc/protobuf/nghttptext except a comment line inplatformio.ini:1; the link isrole::Link(src/main.cpp)m,c,r) at connectpython/onemachine/machine.py:153-154(_text('m'),_text('r'),_text('c')); the ops are documented atinclude/oneMachine/role/link.h:6and served at:82include/oneMachine/role/link.h:8(s/g), BadHash handling atpython/onemachine/machine.py:175-186value,scale,unitlines a kind printsinclude/oneMachine/role/face.h:37-47(Params::value/scale/unit); read inpython/onemachine/machine.py(RoleInfo.values/scales/units)gateway.py:57(rows are kinds); role names, limits, values, labels, scales, units and text length come from the description inmodel()gateway.py:92-168(info.params,info.values,info.scales,info.units, the command field's size at:147)light'slevelis bounded by itsmaxparametergateway.py:59(upper='max'),:117-121gateway.py:171fdl(),:216write_fdl, called at start:321; a changed label gives a new Set after a reconnect (ran on a Nano: the machine hash changes and the served Set follows)gateway.py:97(kind),:98(tuned),:102(line the row does not use),:142/:153(unit symbol); "never serves part of a machine":model()raises on the first problem and:168on no roles; the exit message names the role::317. Ran: 13 edited descriptions (labels, stray lines, unit symbols, scale, unknown kind and line) each refused as expectedparam max(gateway.py:117), thevaluelines (:123-135),maxandscale(:154-161).examples/silameets the rule by refusing tuned roles (gateway.py:98); it has no path that turns a run-time value into a readable property, which is what the page now says. Main's description format has no compile-time/run-time column onparamsetter(gateway.py:259); ran with an independent client (unitelabs-sila):ValidationErrorand no command frame on the linkinclude/oneMachine/role/kinds.h:54-56(Light::apply); ignore:examples/sila/src/kinds.h:19(Discrete),:43(Select),:73(Text),:88(Scaled). Ran (above)applyfunctions end withr.* = E::get()(kinds.h:56;examples/sila/src/kinds.h:19,43,73,88)gateway.py:72-78(to_raw: nearest, halves away from zero), publish converts the report back (gateway.py:279..); ran on a Nano:SetValue(12.35)reads back 12.4gateway.py:268and:273(m.push()once;firesets the flag around exactly one push)examples/sila/src/main.cpp:3("There is no timeout: a value that was set stays set")RLockaround every push and poll:gateway.py:248,:260,:270,:280; ran: 20 concurrentFire()+ 20SetLevel()→ exactly +20gateway.py:313(oneMachine),:249(uuid5of originator, server type and hash); the same firmware gave the same UUID on the host and on the Nanogateway.py:57-66,:97sila_baseFDL schema (all of them valid; copies with a required element removed are rejected)Statements that are design, not code, and so not checkable here: "a machine that a consumer can serve can be served by every other consumer that knows the same kinds" and "kinds and consumers grow independently".
Not changed: HAPI; any code.
🤖 Generated with Claude Code