dynalite-eeprom 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. dynalite_eeprom-0.1.0/.github/workflows/ci.yml +46 -0
  2. dynalite_eeprom-0.1.0/.github/workflows/release.yml +30 -0
  3. dynalite_eeprom-0.1.0/.gitignore +15 -0
  4. dynalite_eeprom-0.1.0/.pre-commit-config.yaml +22 -0
  5. dynalite_eeprom-0.1.0/.python-version +1 -0
  6. dynalite_eeprom-0.1.0/CHANGELOG.md +44 -0
  7. dynalite_eeprom-0.1.0/LICENSE +21 -0
  8. dynalite_eeprom-0.1.0/PKG-INFO +264 -0
  9. dynalite_eeprom-0.1.0/README.md +241 -0
  10. dynalite_eeprom-0.1.0/RELEASING.md +142 -0
  11. dynalite_eeprom-0.1.0/pyproject.toml +94 -0
  12. dynalite_eeprom-0.1.0/src/dynalite_eeprom/__init__.py +98 -0
  13. dynalite_eeprom-0.1.0/src/dynalite_eeprom/__main__.py +5 -0
  14. dynalite_eeprom-0.1.0/src/dynalite_eeprom/cli.py +129 -0
  15. dynalite_eeprom-0.1.0/src/dynalite_eeprom/config.py +596 -0
  16. dynalite_eeprom-0.1.0/src/dynalite_eeprom/container.py +124 -0
  17. dynalite_eeprom-0.1.0/src/dynalite_eeprom/devices.py +642 -0
  18. dynalite_eeprom-0.1.0/src/dynalite_eeprom/encode.py +256 -0
  19. dynalite_eeprom-0.1.0/src/dynalite_eeprom/functions.py +231 -0
  20. dynalite_eeprom-0.1.0/src/dynalite_eeprom/image.py +62 -0
  21. dynalite_eeprom-0.1.0/src/dynalite_eeprom/link.py +323 -0
  22. dynalite_eeprom-0.1.0/src/dynalite_eeprom/program.py +489 -0
  23. dynalite_eeprom-0.1.0/src/dynalite_eeprom/py.typed +0 -0
  24. dynalite_eeprom-0.1.0/src/dynalite_eeprom/report.py +374 -0
  25. dynalite_eeprom-0.1.0/src/dynalite_eeprom/syntax.py +622 -0
  26. dynalite_eeprom-0.1.0/tests/__init__.py +0 -0
  27. dynalite_eeprom-0.1.0/tests/builder.py +267 -0
  28. dynalite_eeprom-0.1.0/tests/test_config.py +484 -0
  29. dynalite_eeprom-0.1.0/tests/test_devices.py +336 -0
  30. dynalite_eeprom-0.1.0/tests/test_encode.py +274 -0
  31. dynalite_eeprom-0.1.0/tests/test_functions.py +185 -0
  32. dynalite_eeprom-0.1.0/tests/test_image_and_container.py +80 -0
  33. dynalite_eeprom-0.1.0/tests/test_link.py +294 -0
  34. dynalite_eeprom-0.1.0/tests/test_program.py +253 -0
  35. dynalite_eeprom-0.1.0/tests/test_report_and_cli.py +275 -0
  36. dynalite_eeprom-0.1.0/tests/test_site.py +278 -0
  37. dynalite_eeprom-0.1.0/tests/test_syntax.py +196 -0
  38. dynalite_eeprom-0.1.0/uv.lock +523 -0
@@ -0,0 +1,46 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v7
16
+ - uses: astral-sh/setup-uv@v10.3.3
17
+ - run: uv sync --locked
18
+ - run: uv run ruff format --check
19
+ - run: uv run ruff check
20
+ - run: uv run mypy
21
+
22
+ test:
23
+ runs-on: ${{ matrix.os }}
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ os: [ubuntu-latest, macos-latest]
28
+ python: ["3.13", "3.14"]
29
+ steps:
30
+ - uses: actions/checkout@v7
31
+ - uses: astral-sh/setup-uv@v10.3.3
32
+ with:
33
+ python-version: ${{ matrix.python }}
34
+ - run: uv sync --locked
35
+ - run: uv run pytest --cov --cov-report=term-missing
36
+
37
+ build:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v7
41
+ - uses: astral-sh/setup-uv@v10.3.3
42
+ - run: uv build
43
+ - uses: actions/upload-artifact@v7
44
+ with:
45
+ name: dist
46
+ path: dist/
@@ -0,0 +1,30 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write # PyPI trusted publishing, no API token stored
13
+ contents: write # attach the built files to the GitHub release
14
+ steps:
15
+ - uses: actions/checkout@v7
16
+ - uses: astral-sh/setup-uv@v10.3.3
17
+ - name: Check the tag matches the package version
18
+ run: |
19
+ version=$(uv version --short)
20
+ test "v${version}" = "${GITHUB_REF_NAME}" || {
21
+ echo "Tag ${GITHUB_REF_NAME} does not match version ${version}"; exit 1; }
22
+ - run: uv sync --locked
23
+ - run: uv run pytest
24
+ - run: uv build
25
+ - run: uvx twine check --strict dist/*
26
+ - run: uv publish --trusted-publishing always
27
+ - name: Attach the files to the GitHub release
28
+ env:
29
+ GH_TOKEN: ${{ github.token }}
30
+ run: gh release upload "${GITHUB_REF_NAME}" dist/*
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ build/
5
+ dist/
6
+ *.egg-info/
7
+ .coverage
8
+ .coverage.*
9
+ coverage.xml
10
+ htmlcov/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .pytest_cache/
14
+ .hypothesis/
15
+ .DS_Store
@@ -0,0 +1,22 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.17.5
4
+ hooks:
5
+ - id: ruff-check
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ - repo: https://github.com/pre-commit/pre-commit-hooks
9
+ rev: v6.0.0
10
+ hooks:
11
+ - id: check-toml
12
+ - id: check-yaml
13
+ - id: end-of-file-fixer
14
+ - id: trailing-whitespace
15
+ - repo: local
16
+ hooks:
17
+ - id: mypy
18
+ name: mypy
19
+ entry: uv run mypy
20
+ language: system
21
+ types: [python]
22
+ pass_filenames: false
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-11-28)
4
+
5
+ First release: decode DyNet device memory dumps, show them as YAML, and
6
+ compile edited YAML back into a memory image to write with `dynet write`.
7
+
8
+ - First version: decodes the shared container format (header, programming
9
+ stamp, section directory, text), Antumbra panel buttons (programs per
10
+ event, channels resolved to areas, labels, indicators, local tasks), relay
11
+ controller outputs, sensor settings and PDEG tasks. JSON output with
12
+ `--json`. Undecoded text sub-sections, which can hold credentials, are
13
+ never shown.
14
+ - `encode` writes edited fields back into the image they were decoded from,
15
+ keeping every byte it doesn't understand, and refuses edits it can't write.
16
+ `changes` lists the byte runs that differ. Writable: the programming stamp,
17
+ and sensor settings (motion LED, timeouts, action delay, resend inhibit,
18
+ light detector settings and band limits).
19
+ - Configuration as YAML: `dynalite-eeprom export FILE` writes a device's
20
+ configuration, and `dynalite-eeprom compile CONFIG --base FILE -o OUT`
21
+ applies an edited one to its dump, sets the stamp, and lists the changed
22
+ bytes. Edits that can't be written yet are refused by path. The old
23
+ `dynalite-eeprom FILE…` still works (now also `show`). Depends on PyYAML.
24
+ - Programs as text in System Builder's task syntax, with labels
25
+ (`dynalite_eeprom.syntax`: `format_program`, and `assemble`, which gives
26
+ back the exact bytes). The YAML export uses it.
27
+ - Button functions (`dynalite_eeprom.functions`): `recognise` shows a button
28
+ as System Builder's `RecallUserPreset`, `TogglePreset`, `OneTouchRampOnly`
29
+ or `LocalTaskControl` with its settings, only when `expand` gives back the
30
+ button's exact programs.
31
+ - Panel buttons are writable in the YAML configuration: a `function` or
32
+ `events` programs, and `flags`. `dynalite_eeprom.link.link_buttons` lays
33
+ the programs out as System Builder does and rewrites pointers and sizes;
34
+ every panel at the test site relinks to identical bytes. Programs that
35
+ branch to fixed addresses or hold undecoded bytes aren't moved.
36
+ - Decodes `ab`, System Builder's "Preset To Area" button action, as
37
+ `PresetToArea(A=…, P=…, F=…)` (confirmed on hardware and in System
38
+ Builder's Action Chain Editor). The rumpus TV button now decodes fully.
39
+ - A button program's undecoded bytes now stop where the next program
40
+ starts, rather than always showing 16 bytes.
41
+ - Panel tasks are writable in the YAML configuration (`link_tasks`). Every
42
+ panel at the test site, and every dump from the task probes, relinks to
43
+ identical bytes. A task's program now covers its whole slot, so an extra
44
+ end byte System Builder sometimes leaves shows as a second `Null`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sam Dunster
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.5
2
+ Name: dynalite-eeprom
3
+ Version: 0.1.0
4
+ Summary: Unofficial decoder for the memory of Signify Dynalite DyNet devices: panel buttons, channels, sensors and tasks
5
+ Project-URL: Homepage, https://github.com/sdunster/dynalite-eeprom
6
+ Project-URL: Issues, https://github.com/sdunster/dynalite-eeprom/issues
7
+ Author-email: Sam Dunster <me@sdunster.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: dynalite,dynet,eeprom,lighting,signify
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Home Automation
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.13
21
+ Requires-Dist: pyyaml>=6.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ # dynalite-eeprom
25
+
26
+ Decode memory dumps of Signify Dynalite DyNet devices: what each panel button
27
+ does, which areas relay channels and sensors act on, button labels, device
28
+ names, and tasks.
29
+
30
+ An unofficial tool, not affiliated with or endorsed by Signify.
31
+
32
+ It reads and writes files only, and never talks to a bus. Make the dumps with
33
+ [dynet-cli](https://github.com/sdunster/dynet-cli)'s `dynet dump -o`, which
34
+ reads a device's whole EEPROM over the gateway.
35
+
36
+ The layout was worked out from one site's devices, matched against System
37
+ Builder's export of the same site. Every decoded field matched that export
38
+ (168 panel buttons, 36 relay channels, 12 sensors), but other models and
39
+ firmware may differ. Anything not decoded is left out or kept as raw bytes,
40
+ never guessed.
41
+
42
+ ## Install
43
+
44
+ ```console
45
+ $ pipx install dynalite-eeprom # or: uv tool install dynalite-eeprom
46
+ ```
47
+
48
+ It needs Python 3.13 or later. To read and write devices, also install
49
+ [dynet-cli](https://github.com/sdunster/dynet-cli) (`dynet dump`,
50
+ `dynet write`).
51
+
52
+ ## Use
53
+
54
+ ```console
55
+ $ dynet dump 0xfd:51 -o rumpus.bin
56
+ $ dynalite-eeprom rumpus.bin
57
+ device 0xfd box 51 'Rumpus': model 864, firmware 3.23, PCB 2.3, 64 KiB read
58
+ programmed: no stamp
59
+ button 1 (Medium):
60
+ on press:
61
+ 0x21b6 recall preset 2 on area 8 all channels, fade 1 s, join 0xff
62
+ 0x21c2 end
63
+ button 3 (Curtains):
64
+ on press:
65
+ 0x21d0 if [40 1a 10 55] goto 0x21e5
66
+ 0x21d8 recall preset 1 on area 144 all channels, fade 0 s, join 0xff
67
+ 0x21e4 end
68
+ 0x21e5 recall preset 4 on area 144 all channels, fade 0 s, join 0xff
69
+ 0x21f1 end
70
+ …
71
+ ```
72
+
73
+ `--json` prints the same as JSON, with raw bytes as hex. Several files can be
74
+ given at once.
75
+
76
+ From Python:
77
+
78
+ ```python
79
+ from dynalite_eeprom import Image, Panel, decode, describe
80
+
81
+ memory = decode(Image.from_file("rumpus.bin"))
82
+ if isinstance(memory, Panel):
83
+ for button in memory.buttons:
84
+ for event in button.events:
85
+ for instruction in event.program:
86
+ print(button.number, event.name, describe(instruction, memory.channels))
87
+ ```
88
+
89
+ ## Configuration as YAML
90
+
91
+ `export` writes everything the decoder understands about a device as a YAML
92
+ document. Edit it, then `compile` it against the dump it came from to get the
93
+ new memory image and the bytes that changed:
94
+
95
+ ```console
96
+ $ dynalite-eeprom export hall.bin -o hall.yaml
97
+ $ $EDITOR hall.yaml # motion_led: false
98
+ $ dynalite-eeprom compile hall.yaml --base hall.bin -o hall-new.bin
99
+ 0x001a: 00 03 95 f5 cf
100
+ 0x0223: f8
101
+ ```
102
+
103
+ The document shows the whole device, but only some settings can be written
104
+ so far (the comment at its top lists them; see Editing below). Compiling
105
+ checks itself: it exports the new image again and refuses unless that gives
106
+ back your document, naming each setting it can't write yet:
107
+
108
+ ```console
109
+ $ dynalite-eeprom compile hall.yaml --base hall.bin -o hall-new.bin
110
+ dynalite-eeprom: can't write these (yet): name, sensor.presets[2].on_motion[0]
111
+ ```
112
+
113
+ When anything changes, compiling sets the programming stamp to now, as System
114
+ Builder does on each write (`--keep-stamp` leaves it).
115
+
116
+ ### Programs and button functions
117
+
118
+ Programs (button events, tasks, sensor actions) are written in System
119
+ Builder's task syntax where it has one, with labels for branch targets:
120
+
121
+ ```yaml
122
+ events:
123
+ hold:
124
+ - LDA ^26[LC14] // area 2
125
+ - BNE L1
126
+ - RampToLevel(LC=14, L=100%, T=5) // area 2
127
+ - Null
128
+ - 'L1: LDA ^42[LC14] // area 2'
129
+ ...
130
+ tasks:
131
+ - number: 1
132
+ program:
133
+ - Preset(A=19, P=3, F=1.5)
134
+ - Delay(2.5)
135
+ - 'Null'
136
+ ```
137
+
138
+ The text is lossless: `dynalite_eeprom.syntax.assemble` turns it back into
139
+ exactly the bytes it came from. Instructions that act on the panel's own
140
+ logical channels have no text form in System Builder, so they're this
141
+ package's own: `RecallPreset(LC=…)`, `RampToLevel`, `StopFade`,
142
+ `PresetToArea(A=…)` (System Builder's "Preset To Area" action), and port
143
+ reads such as `LDA ^26[LC14]`. Bytes the disassembler doesn't know are kept
144
+ as `Raw(…)`.
145
+
146
+ A button set up with one of System Builder's button functions is shown as
147
+ that function instead of its programs:
148
+
149
+ ```yaml
150
+ function: {name: TogglePreset, area: 144, on_preset: 1, off_preset: 4, fade: 0, lc: 16}
151
+ ```
152
+
153
+ Known functions: `RecallUserPreset`, `TogglePreset`, `OneTouchRampOnly` and
154
+ `LocalTaskControl`. A function is only shown when expanding it gives back
155
+ exactly the button's programs. At the test site that's every button System
156
+ Builder's export gives one of these functions (154 buttons), with the
157
+ export's settings.
158
+
159
+ Panel buttons are writable: give each a `function`, or `events` with a
160
+ program per event (press, short press, hold, release), and set `flags`.
161
+ Compiling lays the programs out the way System Builder does (see
162
+ `dynalite_eeprom.link`): back to back after the button table, in button and
163
+ event order, with the pointers and section sizes rewritten, and the section
164
+ padded to 16 bytes. Unchanged buttons give back the identical bytes (every
165
+ panel at the test site), so a write changes only what differs, plus any
166
+ programs that move. A program that branches to a fixed address instead of a
167
+ label, or holds `Raw(…)` bytes, can't be moved. A function's `area` is for
168
+ reading: it must match its `lc` (choosing a channel by area isn't supported
169
+ yet).
170
+
171
+ Panel tasks are writable too: `panel.tasks` lists each task's number (1-64)
172
+ and program, and unlisted tasks are left empty. They're laid out as System
173
+ Builder does: the startup program, then tasks 1-64 back to back, with the
174
+ 64-entry table it creates the first time a panel gets a task. Listeners,
175
+ task names, button labels, indicators and sensor programs are still
176
+ read-only. Like the
177
+ dumps, the documents describe a real site: keep them out of public places.
178
+
179
+ ## Editing
180
+
181
+ `encode` writes edited fields back into the image they were decoded from,
182
+ and `changes` lists the byte ranges that differ, which is all a write to the
183
+ device needs to send:
184
+
185
+ ```python
186
+ from dynalite_eeprom import Image, Sensor, changes, decode, encode
187
+
188
+ image = Image.from_file("hall.bin")
189
+ memory = decode(image)
190
+ assert isinstance(memory, Sensor)
191
+ memory.motion_led = False
192
+ for change in changes(image, encode(memory, image)):
193
+ print(f"0x{change.address:04x}: {change.data.hex(' ')}") # 0x0223: f8
194
+ ```
195
+
196
+ Nothing is rebuilt from scratch: bytes the decoder doesn't understand stay
197
+ as read. `encode` decodes its result and raises `EncodeError` unless that
198
+ gives back exactly the edited memory, so an edit to a field it can't write
199
+ yet is refused rather than lost. Writable so far: the programming stamp on
200
+ every device; panel buttons (through the YAML configuration); and on sensors
201
+ the motion LED, the no-motion timeouts (global and per preset), the action
202
+ delay, the resend inhibit period, and the light detector's settings and band
203
+ limits. Unchanged memory encodes to the
204
+ identical bytes for every device at the test site.
205
+
206
+ This package doesn't write to devices. Check the result before sending it,
207
+ and keep the dump it came from so the device can be restored.
208
+
209
+ ## What it decodes
210
+
211
+ | Device | Decoded |
212
+ |---|---|
213
+ | All but the DALI controller | Header (device code, box, firmware, model ID, PCB version), the time System Builder last wrote it, the section directory, name and other `key=value` text |
214
+ | Antumbra panels (0xfd) | Each button's programs per event, with logical channels resolved to areas; button labels; indicator mode and preset; local tasks |
215
+ | Relay controllers (0x4c) | Each output's area and logical channel, with area names |
216
+ | Sensors (0xb3) | Motion area, no-motion timeout, motion LED, light detector band count |
217
+ | PDEG gateways (0xdc) | Tasks, with their names |
218
+ | DALI controllers (0x64), others | Header only: their layout is different |
219
+
220
+ Button programs are a small bytecode: recall preset, ramp to level, stop
221
+ fade, conditional jump, run local task and send packet. Conditions aren't
222
+ decoded yet, and are shown as raw bytes. The four event slots are labelled
223
+ press, short press, hold and release; that's inferred from which buttons use
224
+ them, and not confirmed.
225
+
226
+ ## The memory layout
227
+
228
+ Panels, sensors, relay controllers and PDEGs share one container format:
229
+
230
+ - **Header:** a 10-byte header at 0x00.
231
+ - **Programming stamp:** at 0x1A, `00` then seconds since 2025-01-01 UTC.
232
+ - **Section directory:** 24 16-bit pointers at 0x20.
233
+ - **Sections:** each starts with a type byte and its own 16-bit size.
234
+
235
+ The workspace notes this was written from (`EEPROM-FINDINGS.md`) cover the
236
+ details, the evidence and what's still unknown.
237
+
238
+ ## Credentials
239
+
240
+ A PDEG's text section also holds XML and strings that look like keys or
241
+ credentials. dynalite-eeprom only decodes the first text sub-section, which
242
+ holds the `key=value` strings. For the others it shows the address and size,
243
+ never their contents. Treat the dump files themselves as sensitive.
244
+
245
+ ## Development
246
+
247
+ ```sh
248
+ uv sync
249
+ uv run pytest --cov
250
+ uv run ruff check && uv run ruff format --check && uv run mypy
251
+ ```
252
+
253
+ The tests build synthetic memory images (`tests/builder.py`), so no real
254
+ site's data is in the repository. To check against real dumps, point
255
+ `DYNALITE_EEPROM_SITE` at a folder with the `*.bin` files (named like
256
+ `fd-023-pantry.bin`) and System Builder's `*Devices.xml` export:
257
+
258
+ ```sh
259
+ DYNALITE_EEPROM_SITE=~/site uv run pytest tests/test_site.py
260
+ ```
261
+
262
+ ## Licence
263
+
264
+ MIT
@@ -0,0 +1,241 @@
1
+ # dynalite-eeprom
2
+
3
+ Decode memory dumps of Signify Dynalite DyNet devices: what each panel button
4
+ does, which areas relay channels and sensors act on, button labels, device
5
+ names, and tasks.
6
+
7
+ An unofficial tool, not affiliated with or endorsed by Signify.
8
+
9
+ It reads and writes files only, and never talks to a bus. Make the dumps with
10
+ [dynet-cli](https://github.com/sdunster/dynet-cli)'s `dynet dump -o`, which
11
+ reads a device's whole EEPROM over the gateway.
12
+
13
+ The layout was worked out from one site's devices, matched against System
14
+ Builder's export of the same site. Every decoded field matched that export
15
+ (168 panel buttons, 36 relay channels, 12 sensors), but other models and
16
+ firmware may differ. Anything not decoded is left out or kept as raw bytes,
17
+ never guessed.
18
+
19
+ ## Install
20
+
21
+ ```console
22
+ $ pipx install dynalite-eeprom # or: uv tool install dynalite-eeprom
23
+ ```
24
+
25
+ It needs Python 3.13 or later. To read and write devices, also install
26
+ [dynet-cli](https://github.com/sdunster/dynet-cli) (`dynet dump`,
27
+ `dynet write`).
28
+
29
+ ## Use
30
+
31
+ ```console
32
+ $ dynet dump 0xfd:51 -o rumpus.bin
33
+ $ dynalite-eeprom rumpus.bin
34
+ device 0xfd box 51 'Rumpus': model 864, firmware 3.23, PCB 2.3, 64 KiB read
35
+ programmed: no stamp
36
+ button 1 (Medium):
37
+ on press:
38
+ 0x21b6 recall preset 2 on area 8 all channels, fade 1 s, join 0xff
39
+ 0x21c2 end
40
+ button 3 (Curtains):
41
+ on press:
42
+ 0x21d0 if [40 1a 10 55] goto 0x21e5
43
+ 0x21d8 recall preset 1 on area 144 all channels, fade 0 s, join 0xff
44
+ 0x21e4 end
45
+ 0x21e5 recall preset 4 on area 144 all channels, fade 0 s, join 0xff
46
+ 0x21f1 end
47
+ …
48
+ ```
49
+
50
+ `--json` prints the same as JSON, with raw bytes as hex. Several files can be
51
+ given at once.
52
+
53
+ From Python:
54
+
55
+ ```python
56
+ from dynalite_eeprom import Image, Panel, decode, describe
57
+
58
+ memory = decode(Image.from_file("rumpus.bin"))
59
+ if isinstance(memory, Panel):
60
+ for button in memory.buttons:
61
+ for event in button.events:
62
+ for instruction in event.program:
63
+ print(button.number, event.name, describe(instruction, memory.channels))
64
+ ```
65
+
66
+ ## Configuration as YAML
67
+
68
+ `export` writes everything the decoder understands about a device as a YAML
69
+ document. Edit it, then `compile` it against the dump it came from to get the
70
+ new memory image and the bytes that changed:
71
+
72
+ ```console
73
+ $ dynalite-eeprom export hall.bin -o hall.yaml
74
+ $ $EDITOR hall.yaml # motion_led: false
75
+ $ dynalite-eeprom compile hall.yaml --base hall.bin -o hall-new.bin
76
+ 0x001a: 00 03 95 f5 cf
77
+ 0x0223: f8
78
+ ```
79
+
80
+ The document shows the whole device, but only some settings can be written
81
+ so far (the comment at its top lists them; see Editing below). Compiling
82
+ checks itself: it exports the new image again and refuses unless that gives
83
+ back your document, naming each setting it can't write yet:
84
+
85
+ ```console
86
+ $ dynalite-eeprom compile hall.yaml --base hall.bin -o hall-new.bin
87
+ dynalite-eeprom: can't write these (yet): name, sensor.presets[2].on_motion[0]
88
+ ```
89
+
90
+ When anything changes, compiling sets the programming stamp to now, as System
91
+ Builder does on each write (`--keep-stamp` leaves it).
92
+
93
+ ### Programs and button functions
94
+
95
+ Programs (button events, tasks, sensor actions) are written in System
96
+ Builder's task syntax where it has one, with labels for branch targets:
97
+
98
+ ```yaml
99
+ events:
100
+ hold:
101
+ - LDA ^26[LC14] // area 2
102
+ - BNE L1
103
+ - RampToLevel(LC=14, L=100%, T=5) // area 2
104
+ - Null
105
+ - 'L1: LDA ^42[LC14] // area 2'
106
+ ...
107
+ tasks:
108
+ - number: 1
109
+ program:
110
+ - Preset(A=19, P=3, F=1.5)
111
+ - Delay(2.5)
112
+ - 'Null'
113
+ ```
114
+
115
+ The text is lossless: `dynalite_eeprom.syntax.assemble` turns it back into
116
+ exactly the bytes it came from. Instructions that act on the panel's own
117
+ logical channels have no text form in System Builder, so they're this
118
+ package's own: `RecallPreset(LC=…)`, `RampToLevel`, `StopFade`,
119
+ `PresetToArea(A=…)` (System Builder's "Preset To Area" action), and port
120
+ reads such as `LDA ^26[LC14]`. Bytes the disassembler doesn't know are kept
121
+ as `Raw(…)`.
122
+
123
+ A button set up with one of System Builder's button functions is shown as
124
+ that function instead of its programs:
125
+
126
+ ```yaml
127
+ function: {name: TogglePreset, area: 144, on_preset: 1, off_preset: 4, fade: 0, lc: 16}
128
+ ```
129
+
130
+ Known functions: `RecallUserPreset`, `TogglePreset`, `OneTouchRampOnly` and
131
+ `LocalTaskControl`. A function is only shown when expanding it gives back
132
+ exactly the button's programs. At the test site that's every button System
133
+ Builder's export gives one of these functions (154 buttons), with the
134
+ export's settings.
135
+
136
+ Panel buttons are writable: give each a `function`, or `events` with a
137
+ program per event (press, short press, hold, release), and set `flags`.
138
+ Compiling lays the programs out the way System Builder does (see
139
+ `dynalite_eeprom.link`): back to back after the button table, in button and
140
+ event order, with the pointers and section sizes rewritten, and the section
141
+ padded to 16 bytes. Unchanged buttons give back the identical bytes (every
142
+ panel at the test site), so a write changes only what differs, plus any
143
+ programs that move. A program that branches to a fixed address instead of a
144
+ label, or holds `Raw(…)` bytes, can't be moved. A function's `area` is for
145
+ reading: it must match its `lc` (choosing a channel by area isn't supported
146
+ yet).
147
+
148
+ Panel tasks are writable too: `panel.tasks` lists each task's number (1-64)
149
+ and program, and unlisted tasks are left empty. They're laid out as System
150
+ Builder does: the startup program, then tasks 1-64 back to back, with the
151
+ 64-entry table it creates the first time a panel gets a task. Listeners,
152
+ task names, button labels, indicators and sensor programs are still
153
+ read-only. Like the
154
+ dumps, the documents describe a real site: keep them out of public places.
155
+
156
+ ## Editing
157
+
158
+ `encode` writes edited fields back into the image they were decoded from,
159
+ and `changes` lists the byte ranges that differ, which is all a write to the
160
+ device needs to send:
161
+
162
+ ```python
163
+ from dynalite_eeprom import Image, Sensor, changes, decode, encode
164
+
165
+ image = Image.from_file("hall.bin")
166
+ memory = decode(image)
167
+ assert isinstance(memory, Sensor)
168
+ memory.motion_led = False
169
+ for change in changes(image, encode(memory, image)):
170
+ print(f"0x{change.address:04x}: {change.data.hex(' ')}") # 0x0223: f8
171
+ ```
172
+
173
+ Nothing is rebuilt from scratch: bytes the decoder doesn't understand stay
174
+ as read. `encode` decodes its result and raises `EncodeError` unless that
175
+ gives back exactly the edited memory, so an edit to a field it can't write
176
+ yet is refused rather than lost. Writable so far: the programming stamp on
177
+ every device; panel buttons (through the YAML configuration); and on sensors
178
+ the motion LED, the no-motion timeouts (global and per preset), the action
179
+ delay, the resend inhibit period, and the light detector's settings and band
180
+ limits. Unchanged memory encodes to the
181
+ identical bytes for every device at the test site.
182
+
183
+ This package doesn't write to devices. Check the result before sending it,
184
+ and keep the dump it came from so the device can be restored.
185
+
186
+ ## What it decodes
187
+
188
+ | Device | Decoded |
189
+ |---|---|
190
+ | All but the DALI controller | Header (device code, box, firmware, model ID, PCB version), the time System Builder last wrote it, the section directory, name and other `key=value` text |
191
+ | Antumbra panels (0xfd) | Each button's programs per event, with logical channels resolved to areas; button labels; indicator mode and preset; local tasks |
192
+ | Relay controllers (0x4c) | Each output's area and logical channel, with area names |
193
+ | Sensors (0xb3) | Motion area, no-motion timeout, motion LED, light detector band count |
194
+ | PDEG gateways (0xdc) | Tasks, with their names |
195
+ | DALI controllers (0x64), others | Header only: their layout is different |
196
+
197
+ Button programs are a small bytecode: recall preset, ramp to level, stop
198
+ fade, conditional jump, run local task and send packet. Conditions aren't
199
+ decoded yet, and are shown as raw bytes. The four event slots are labelled
200
+ press, short press, hold and release; that's inferred from which buttons use
201
+ them, and not confirmed.
202
+
203
+ ## The memory layout
204
+
205
+ Panels, sensors, relay controllers and PDEGs share one container format:
206
+
207
+ - **Header:** a 10-byte header at 0x00.
208
+ - **Programming stamp:** at 0x1A, `00` then seconds since 2025-01-01 UTC.
209
+ - **Section directory:** 24 16-bit pointers at 0x20.
210
+ - **Sections:** each starts with a type byte and its own 16-bit size.
211
+
212
+ The workspace notes this was written from (`EEPROM-FINDINGS.md`) cover the
213
+ details, the evidence and what's still unknown.
214
+
215
+ ## Credentials
216
+
217
+ A PDEG's text section also holds XML and strings that look like keys or
218
+ credentials. dynalite-eeprom only decodes the first text sub-section, which
219
+ holds the `key=value` strings. For the others it shows the address and size,
220
+ never their contents. Treat the dump files themselves as sensitive.
221
+
222
+ ## Development
223
+
224
+ ```sh
225
+ uv sync
226
+ uv run pytest --cov
227
+ uv run ruff check && uv run ruff format --check && uv run mypy
228
+ ```
229
+
230
+ The tests build synthetic memory images (`tests/builder.py`), so no real
231
+ site's data is in the repository. To check against real dumps, point
232
+ `DYNALITE_EEPROM_SITE` at a folder with the `*.bin` files (named like
233
+ `fd-023-pantry.bin`) and System Builder's `*Devices.xml` export:
234
+
235
+ ```sh
236
+ DYNALITE_EEPROM_SITE=~/site uv run pytest tests/test_site.py
237
+ ```
238
+
239
+ ## Licence
240
+
241
+ MIT