From 8634712deba3e37bc249cae88d606999085d411a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Wed, 5 Aug 2026 22:35:39 +0200 Subject: [PATCH 1/4] DEV-6448 Add SEB scene and Track examples --- README.md | 4 +- .../seb-causal-scene-recall/README.md | 53 ++++++ .../seb-causal-scene-recall/example.yaml | 33 ++++ .../seb-causal-scene-recall/sce01.seb.json | 24 +++ .../seb-causal-scene-recall/scene-recall.be | 35 ++++ .../seb-segmented-id-track-player/README.md | 58 +++++++ .../example.yaml | 34 ++++ .../segmented-track-player.be | 155 ++++++++++++++++++ .../track-artifacts.json | 49 ++++++ 9 files changed, 444 insertions(+), 1 deletion(-) create mode 100644 data/v2/examples/seb-causal-scene-recall/README.md create mode 100644 data/v2/examples/seb-causal-scene-recall/example.yaml create mode 100644 data/v2/examples/seb-causal-scene-recall/sce01.seb.json create mode 100644 data/v2/examples/seb-causal-scene-recall/scene-recall.be create mode 100644 data/v2/examples/seb-segmented-id-track-player/README.md create mode 100644 data/v2/examples/seb-segmented-id-track-player/example.yaml create mode 100644 data/v2/examples/seb-segmented-id-track-player/segmented-track-player.be create mode 100644 data/v2/examples/seb-segmented-id-track-player/track-artifacts.json diff --git a/README.md b/README.md index 8ac7a46..d8b0b7d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,9 @@ data/v2/examples/ ├── controller-push-button-click-hold-dim-dali/ # momentary push button: short click toggles, hold dims brigh ├── controller-toggle-button-hold-dim-dali/ # single toggle button ramps DALI brightness, reverses on press ├── gledopto-gl-rc-001wl-espnow-remote/ # Berry espnow.rx examples for a GLEDOPTO GL-RC-001WL remote -└── network-nested-element-groups/ # App elementsJson + controlPages group → groups → devices pattern +├── network-nested-element-groups/ # App elementsJson + controlPages group → groups → devices pattern +├── seb-causal-scene-recall/ # recall a mixed-ID SEB scene at the causal event time +└── seb-segmented-id-track-player/ # play an ordered one-ID Track from bounded SEB segments ``` ## Example Rules diff --git a/data/v2/examples/seb-causal-scene-recall/README.md b/data/v2/examples/seb-causal-scene-recall/README.md new file mode 100644 index 0000000..542b381 --- /dev/null +++ b/data/v2/examples/seb-causal-scene-recall/README.md @@ -0,0 +1,53 @@ +# Causal NetworkStorage Scene Recall with SEB + +This firmware 0.12.11 example turns a normal LABEL EventState into a local +multi-event scene on every prepared Controller. + +An authoritative source emits: + +```berry +spectoda.emitEvent("scene", "sce01", ID255, 31) +``` + +`scene-recall.be` observes `$scene[ID255]`, loads `sce01.seb` from local +NetworkStorage and calls `SEB.land` with the callback's exact `event_millis`. +All zero-offset scene records therefore receive the same causal Network clock +as the event that requested the scene. + +## Requirements + +- Firmware must be exactly **0.12.11** with the final fixed-record SEB v1 API. +- Add `scene-recall.be` to the Project Berry loaded on every participating + Controller. +- Upload the exact bytes from the `hex` field in `sce01.seb.json` as a binary + NetworkStorage file named `sce01.seb` on those Controllers. +- The trigger EventState is `$scene[ID255]` with a LABEL value. +- Do not include `$scene[ID255]` in the compiled scene, or recall would recurse. + +The synthetic scene changes: + +- `$brigh[ID255]` to `50%` +- `$color[ID1]` to `#112233` with priority `7` + +SEB still uses EventStore as the only state authority. A Controller that misses +the simultaneous local landing may converge later through normal EventStore +synchronization. + +## `SEB.land`, not `SEB.emit` + +The same Project script runs on multiple Controllers, so it must use +`SEB.land`. Calling `SEB.emit` independently from all of them would multiply +network traffic and duplicate authoritative emissions. Reserve `SEB.emit` for +one deliberately selected source. + +## Failure and retry behavior + +The scene is validated and its complete deduplicated contribution is reserved +before EventStore changes. A validation, time-conversion or queue-capacity +failure applies nothing and returns a named error. The example logs that error; +a production Project can retry the same `(bytes, at)` pair after the runtime +queue has drained. + +The provisional variable-record blob from the earlier unreleased development +work is not accepted by this firmware version. Recompile every scene together +with the Project plugin before using 0.12.11. diff --git a/data/v2/examples/seb-causal-scene-recall/example.yaml b/data/v2/examples/seb-causal-scene-recall/example.yaml new file mode 100644 index 0000000..80ebe8f --- /dev/null +++ b/data/v2/examples/seb-causal-scene-recall/example.yaml @@ -0,0 +1,33 @@ +schemaVersion: example.v2 +slug: seb-causal-scene-recall +title: Causal NetworkStorage Scene Recall with SEB +category: controller +summary: >- + Expand a LABEL EventState such as scene=sce01 into a mixed-ID, zero-duration + SEB scene stored in NetworkStorage. Every prepared Controller lands the scene + through EventStore at the exact local-millis token of the trigger event. +tags: + - berry-plugin + - eventstore + - networkstorage + - scene + - seb + - synchronized-events +hardware: >- + Requires exactly firmware 0.12.11 with the final SEB v1 component. Install + the same Project Berry script and sce01.seb bytes on every Controller that + should land the scene simultaneously. The example uses synthetic EventStates + brigh[ID255] and color[ID1]. It contains no Network key, MAC address or + customer data. +files: + - path: README.md + role: readme + language: markdown + - path: scene-recall.be + role: copy-ready Project Berry plugin + language: berry + - path: sce01.seb.json + role: exact NetworkStorage artifact bytes and decoded reference + language: json +related: + - seb-segmented-id-track-player diff --git a/data/v2/examples/seb-causal-scene-recall/sce01.seb.json b/data/v2/examples/seb-causal-scene-recall/sce01.seb.json new file mode 100644 index 0000000..8d406f9 --- /dev/null +++ b/data/v2/examples/seb-causal-scene-recall/sce01.seb.json @@ -0,0 +1,24 @@ +{ + "schema": "spectoda.seb.artifact.v1", + "firmware": "0.12.11", + "filename": "sce01.seb", + "encoding": "hex", + "hex": "534542010c00020000000c000b08af2fc89148020000ff003f332211d2c33c0300000107", + "durationMs": 0, + "records": [ + { + "value": { "type": "percentage", "value": 50 }, + "identifier": "brigh", + "offsetMs": 0, + "id": 255, + "priority": 0 + }, + { + "value": { "type": "color", "value": "#112233" }, + "identifier": "color", + "offsetMs": 0, + "id": 1, + "priority": 7 + } + ] +} diff --git a/data/v2/examples/seb-causal-scene-recall/scene-recall.be b/data/v2/examples/seb-causal-scene-recall/scene-recall.be new file mode 100644 index 0000000..7b794b8 --- /dev/null +++ b/data/v2/examples/seb-causal-scene-recall/scene-recall.be @@ -0,0 +1,35 @@ +# Project Berry for firmware 0.12.11. +# +# A broadcast $scene[ID255] LABEL event loads