diff --git a/.github/actions/setup-pandoc/action.yml b/.github/actions/setup-pandoc/action.yml
deleted file mode 100644
index 2b827f8..0000000
--- a/.github/actions/setup-pandoc/action.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: "setup-pandoc"
-description: "Composite action to setup pandoc."
-
-inputs:
- pandoc-version:
- required: false
- description: "The pandoc version to use"
- default: "3.2.1"
-
-runs:
- using: "composite"
- steps:
- - name: Load cached Pandoc
- id: cached-pandoc
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
- with:
- path: /usr/local/bin/pandoc
- key: pandoc-${{ runner.os }}-${{ inputs.pandoc-version }}-${{ hashFiles('.tool-versions') }}
- restore-keys: |
- pandoc-${{ runner.os }}-${{ inputs.pandoc-version }}-
-
- - name: Install Pandoc
- if: steps.cached-pandoc.outputs.cache-hit != 'true'
- uses: pandoc/actions/setup@86321b6dd4675f5014c611e05088e10d4939e09e # v1
- with:
- version: ${{ inputs.pandoc-version }}
-
- - name: Run pandoc
- run: pandoc --version
- shell: bash
diff --git a/.github/scripts/release.py b/.github/scripts/release.py
index 86b5f7d..e14c1d2 100644
--- a/.github/scripts/release.py
+++ b/.github/scripts/release.py
@@ -68,7 +68,7 @@ def path(self, root=ROOT):
frozenset(
{
"modsim quality",
- "modsim docs",
+ "docs",
"modsim tox (3.10)",
"modsim tox (3.14)",
"modpoll snapshot replay",
@@ -91,6 +91,7 @@ def path(self, root=ROOT):
"modpoll-wot package",
"consumer (modpoll)",
"consumer (modsim)",
+ "docs",
INTEGRATION,
}
),
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..7180002
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,117 @@
+name: docs
+
+# The documentation site of all three packages (DOC-02). Pull requests and v2 build it with warnings as errors
+# and check its links. A package release, or a manual run, builds it from the release tag and publishes it to
+# /v2/ on gh-pages; the 1.x site at the root and /1.x/ is left alone. A modpoll-wot release also publishes the
+# vocabulary at /vocab/wot-modbus/ from the same checkout. .nojekyll at the root of gh-pages keeps the _static
+# directories served.
+on:
+ push:
+ branches: [v2]
+ paths: &paths
+ - docs/**
+ - packages/**
+ - pyproject.toml
+ - uv.lock
+ - .github/workflows/docs.yml
+ pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
+ paths: *paths
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: Release tag to build and publish, such as modpoll-v2.0.0a13
+ type: string
+ required: true
+ workflow_call:
+ inputs:
+ tag:
+ type: string
+ required: true
+
+permissions:
+ contents: read
+
+jobs:
+ # The release guard (.github/scripts/release.py) requires this check on every release commit.
+ docs:
+ if: ${{ !inputs.tag }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ with:
+ version: 0.11.19
+ python-version: "3.14"
+ enable-cache: true
+ cache-dependency-glob: uv.lock
+ - run: uv sync --locked --only-group docs
+ - run: uv run --no-sync sphinx-build -W --keep-going -b html -d "$RUNNER_TEMP/doctrees" docs "$RUNNER_TEMP/html"
+
+ links:
+ name: docs links
+ if: ${{ !inputs.tag }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ with:
+ version: 0.11.19
+ python-version: "3.14"
+ enable-cache: true
+ cache-dependency-glob: uv.lock
+ - run: uv sync --locked --only-group docs
+ - run: uv run --no-sync sphinx-build -b linkcheck -d "$RUNNER_TEMP/doctrees" docs "$RUNNER_TEMP/linkcheck"
+
+ publish:
+ name: docs publish
+ if: ${{ inputs.tag }}
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ env:
+ TAG: ${{ inputs.tag }}
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ ref: ${{ inputs.tag }}
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ with:
+ version: 0.11.19
+ python-version: "3.14"
+ enable-cache: true
+ cache-dependency-glob: uv.lock
+ - run: uv sync --locked --only-group docs
+ - run: uv run --no-sync sphinx-build -W --keep-going -b html -d "$RUNNER_TEMP/doctrees" docs "$RUNNER_TEMP/html"
+ # The vocabulary is a machine identifier outside the version tree. Files of earlier contract versions are
+ # never removed.
+ - name: Collect the vocabulary
+ if: ${{ startsWith(inputs.tag, 'modpoll-wot-v') }}
+ run: |
+ vocab="$RUNNER_TEMP/vocab"
+ cp -r packages/modpoll-wot/vocab/wot-modbus "$vocab"
+ cp packages/modpoll-wot/modpoll_wot/schemas/acquisition-0.2.json "$vocab/"
+ cp packages/modpoll-wot/profile.md "$vocab/contract-0.2.txt"
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ ref: gh-pages
+ path: pages
+ # Replaces /v2/ only. The packages of one release batch publish at the same time, so a rejected push is
+ # retried on top of the other one.
+ - name: Publish to gh-pages
+ working-directory: pages
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ for attempt in 1 2 3 4 5; do
+ git fetch -q origin gh-pages
+ git reset -q --hard origin/gh-pages
+ rsync -a --delete "$RUNNER_TEMP/html/" v2/
+ if [ -d "$RUNNER_TEMP/vocab" ]; then rsync -a "$RUNNER_TEMP/vocab/" vocab/wot-modbus/; fi
+ git add -A v2 vocab
+ if git diff --cached --quiet; then exit 0; fi
+ git commit -q -m "docs: publish from $TAG"
+ if git push -q origin HEAD:gh-pages; then exit 0; fi
+ sleep $((attempt * 5))
+ done
+ exit 1
diff --git a/.github/workflows/modpoll-release.yml b/.github/workflows/modpoll-release.yml
index 2386b12..68f90ce 100644
--- a/.github/workflows/modpoll-release.yml
+++ b/.github/workflows/modpoll-release.yml
@@ -148,44 +148,11 @@ jobs:
name: modpoll release docs
needs: [candidate, publish]
if: ${{ !cancelled() && needs.candidate.result == 'success' && needs.candidate.outputs.git-tag != '' && (needs.publish.result == 'success' || (github.ref_name == 'v2' && needs.publish.result == 'skipped')) }}
- runs-on: ubuntu-latest
- concurrency:
- group: modpoll-pages
- cancel-in-progress: false
permissions:
contents: write
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- with:
- ref: ${{ needs.candidate.outputs.git-tag }}
- - uses: ./.github/actions/setup-uv
- with:
- package: modpoll
- - uses: ./.github/actions/setup-pandoc
- - name: Build preview documentation
- run: make docs
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- with:
- ref: gh-pages
- path: packages/modpoll/.pages
- - name: Assemble both versions while preserving the vocabulary
- run: |
- mkdir .site
- rsync -a --exclude=.git .pages/ .site/
- test -f .site/1.x/index.html
- test -f .site/vocab/wot-modbus/acquisition-0.1.json
- test -f .site/vocab/wot-modbus/contract-0.1.txt
- wot_version=$(uv run --locked --no-sync python -c 'import importlib.metadata as m; print(m.version("modpoll-wot"))')
- # modpoll-wot is released from this repository since TOOL-01, under packages/modpoll-wot.
- wot_source="https://raw.githubusercontent.com/top-maker/modpoll/modpoll-wot-v$wot_version/packages/modpoll-wot"
- curl -fsSL "$wot_source/modpoll_wot/schemas/acquisition-0.2.json" -o vocab/wot-modbus/acquisition-0.2.json
- curl -fsSL "$wot_source/profile.md" -o vocab/wot-modbus/contract-0.2.txt
- python .github/scripts/assemble-docs.py docs/_build/html .site v2 --vocab vocab
- printf '%s\n' "$(git rev-parse HEAD)" > .site/v2/source-sha.txt
- - uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4
- with:
- github_token: ${{ github.token }}
- publish_dir: packages/modpoll/.site
+ uses: ./.github/workflows/docs.yml
+ with:
+ tag: ${{ needs.candidate.outputs.git-tag }}
acceptance:
name: modpoll release acceptance
needs: [candidate, publish, image, docs]
diff --git a/.github/workflows/modpoll-wot-release.yml b/.github/workflows/modpoll-wot-release.yml
index c52a3ac..a088e3c 100644
--- a/.github/workflows/modpoll-wot-release.yml
+++ b/.github/workflows/modpoll-wot-release.yml
@@ -63,3 +63,12 @@ jobs:
run: |
gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1 ||
gh release create "$GITHUB_REF_NAME" dist/* --verify-tag --prerelease --title "modpoll-wot $VERSION" --notes "See packages/modpoll-wot/CONTRACT.md and profile.md at this tag."
+
+ docs:
+ name: modpoll-wot release docs
+ needs: publish
+ permissions:
+ contents: write
+ uses: ./.github/workflows/docs.yml
+ with:
+ tag: ${{ github.ref_name }}
diff --git a/.github/workflows/modpoll.yml b/.github/workflows/modpoll.yml
index d2264ba..b3a1cc3 100644
--- a/.github/workflows/modpoll.yml
+++ b/.github/workflows/modpoll.yml
@@ -70,25 +70,6 @@ jobs:
- name: Test with tox
run: uv run --locked --no-sync tox -e ${{ matrix.tox-env }}
- docs:
- runs-on: ubuntu-latest
- permissions:
- contents: read
- steps:
- - name: Check out
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
-
- - name: Set up uv
- uses: ./.github/actions/setup-uv
- with:
- package: modpoll
-
- - name: Set up pandoc
- uses: ./.github/actions/setup-pandoc
-
- - name: Build documentation
- run: make docs
-
# Unchanged by TOOL-01: the interop checks keep their pinned 1.x baseline and simulator fixture.
modsim-equivalence:
runs-on: ubuntu-latest
diff --git a/.github/workflows/modsim-release.yml b/.github/workflows/modsim-release.yml
index 7e0a6a0..e48050b 100644
--- a/.github/workflows/modsim-release.yml
+++ b/.github/workflows/modsim-release.yml
@@ -99,20 +99,14 @@ jobs:
# The image installs from the workspace lock, so it builds from the repository root.
run: docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile -t "$REGISTRY/$USERNAME/modsim:${GIT_TAG#modsim-v}" --push ../..
- # The modsim documentation site is not published from this repository yet (TOOL-01 decision 7); the
- # release still proves that the preview documentation builds.
docs:
name: modsim release docs
needs: publish
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- with:
- ref: ${{ github.ref }}
- - uses: ./.github/actions/setup-uv
- with:
- package: modsim
- - run: uv run --locked --no-sync --group docs mkdocs build -s -f mkdocs-preview.yml --site-dir "$RUNNER_TEMP/site"
+ permissions:
+ contents: write
+ uses: ./.github/workflows/docs.yml
+ with:
+ tag: ${{ github.ref_name }}
acceptance:
name: modsim release acceptance
diff --git a/.github/workflows/modsim.yml b/.github/workflows/modsim.yml
index 4e398ce..cd0b798 100644
--- a/.github/workflows/modsim.yml
+++ b/.github/workflows/modsim.yml
@@ -51,6 +51,9 @@ jobs:
- name: Run checks
run: make check
+ - name: Check the generated ADAM-6024 TD
+ run: uv run --locked --no-sync python tools/generate-td.py --check
+
tox:
name: modsim tox (${{ matrix.python-version }})
runs-on: ubuntu-latest
@@ -102,14 +105,3 @@ jobs:
env:
MODSIM_TEST_MODPOLL_PYTHON: ${{ runner.temp }}/modpoll/bin/python
run: uv run --locked pytest tests/test_snapshot_replay.py -v
-
- docs:
- name: modsim docs
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- - uses: ./.github/actions/setup-uv
- with:
- package: modsim
- - run: uv run --locked --no-sync --group docs mkdocs build -s
- - run: uv run --locked --no-sync python tools/generate-td.py --check
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..21aca3b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/docs/_build/
diff --git a/README.md b/README.md
index af15322..e14bfa9 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# modpoll, modsim and modpoll-wot
+**Documentation:**
+
This branch (`v2`) holds three tools that read, simulate and describe Modbus devices with W3C WoT Thing Models.
They are released separately to PyPI and share one uv workspace and one lock file.
@@ -23,3 +25,15 @@ Each package keeps its own `Makefile`, tests and release notes. `integration/` r
modpoll against each other with modpoll-wot's conformance model, over Modbus TCP and RTU on a virtual serial
port (`uv run pytest integration` after the sync above). A release is a tag named after the package,
for example `modsim-v2.0.0a13`, which runs that package's release workflow.
+
+The documentation site for all three packages is built from `docs/` with Sphinx, MyST and Furo. Its dependency
+group needs Python 3.13 or later:
+
+```bash
+uv sync --only-group docs --python 3.14
+uv run --no-sync sphinx-build -W -b html docs docs/_build/html
+uv run --no-sync sphinx-autobuild docs docs/_build/html
+```
+
+Pull requests build it with warnings as errors and check its links. Each package release publishes it from the
+release tag to `/v2/`; a modpoll-wot release also publishes `/vocab/wot-modbus/`.
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..8a2b49f
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,45 @@
+"""Sphinx configuration for the modpoll, modsim and modpoll-wot documentation site (DOC-02)."""
+
+project = "modpoll"
+author = "Ying Shaodong"
+copyright = "2021-2026, Ying Shaodong"
+
+extensions = ["myst_parser", "sphinxarg.ext", "sphinx_reredirects"]
+myst_enable_extensions = ["colon_fence", "deflist"]
+myst_heading_anchors = 3
+
+exclude_patterns = ["_build"]
+# Command-line help keeps its literal "--option" text.
+smartquotes = False
+
+# Pages of the earlier /v2/ site, linked from published release notes.
+redirects = {
+ "installation": "guide/installation.html",
+ "quickstart": "guide/quickstart.html",
+ "usage": "guide/read-a-device.html",
+ "configure": "reference/modpoll/configuration.html",
+ "csv-migration": "guide/migrate-from-v1-csv.html",
+ "v1-compatibility": "reference/modpoll/v1-compatibility.html",
+ "changelog": "reference/modpoll/changelog.html",
+}
+
+html_theme = "furo"
+html_title = "modpoll, modsim and modpoll-wot"
+html_copy_source = False
+html_baseurl = "https://top-maker.github.io/modpoll/v2/"
+html_theme_options = {
+ "source_repository": "https://github.com/top-maker/modpoll/",
+ "source_branch": "v2",
+ "source_directory": "docs/",
+ "announcement": (
+ "This is the 2.x preview of modpoll, modsim and modpoll-wot. "
+ 'Stable modpoll 1.x (CSV configurations) is documented at 1.x.'
+ ),
+}
+
+linkcheck_ignore = [
+ # Placeholders and local addresses in examples.
+ r"https?://(127\.0\.0\.1|localhost)",
+ # Historical modsim changelog entries compare against tags that were never created.
+ r"https://github\.com/top-maker/modsim/compare/v0\.(3\.4|4\.0)\.\.\.",
+]
diff --git a/docs/guide/installation.md b/docs/guide/installation.md
new file mode 100644
index 0000000..de2a6a5
--- /dev/null
+++ b/docs/guide/installation.md
@@ -0,0 +1,43 @@
+# Installation
+
+This site describes the 2.x preview. The three tools need Python 3.10 or later and are installed with
+[uv](https://docs.astral.sh/uv/), which keeps each tool in its own environment. The same commands work in
+Windows PowerShell.
+
+```bash
+uv tool install --prerelease allow "modpoll==2.0.0a13"
+uv tool install --prerelease allow "modsim==2.0.0a15"
+uv tool install --prerelease allow "modpoll-wot==0.7.0a2"
+```
+
+Modbus RTU support (pyserial) is included in modpoll since 2.0.0a12. For existing CSV installations use
+`uv tool install 'modpoll<2'` and the [1.x documentation](https://top-maker.github.io/modpoll/1.x/). See
+[v1 compatibility](../reference/modpoll/v1-compatibility.md) for tested platforms and hardware limits.
+
+To upgrade within the 2.x line, or to uninstall:
+
+```bash
+uv tool install --upgrade --prerelease allow "modpoll<3"
+uv tool uninstall modpoll
+```
+
+To use modpoll-wot as a library, add it to your project with `uv add --prerelease allow modpoll-wot` (or
+`pip install --pre modpoll-wot`). Import from `modpoll_wot` only; its submodules are not a public interface. The
+package ships `py.typed`.
+
+## Run with Docker
+
+The preview images run without a local installation and show the tool version by default:
+
+```bash
+docker run --rm topmaker/modpoll:2.0.0a13
+```
+
+The stable `latest` tag stays on 1.x. To read a local configuration file, mount its folder into the container.
+On Linux, host networking connects the container to a simulator on the host; `-d` (daemon mode) suppresses the
+tables:
+
+```bash
+docker run --rm --network host -v "$(pwd)/examples:/app/examples:ro" topmaker/modpoll:2.0.0a13 \
+ modpoll -d --tcp 127.0.0.1 --tcp-port 5020 --config /app/examples/modsim.tm.json
+```
diff --git a/docs/guide/migrate-from-v1-csv.md b/docs/guide/migrate-from-v1-csv.md
new file mode 100644
index 0000000..01d5aff
--- /dev/null
+++ b/docs/guide/migrate-from-v1-csv.md
@@ -0,0 +1,127 @@
+# Migrate from v1 CSV
+
+modpoll 2.x loads v1 CSV configurations: pass them to `--config` as before, and the format is detected from the
+content. Existing v1 commands keep working unchanged. Migrating to profile 0.2 is still recommended for new or
+heavily edited configurations, because a Thing Model is validated offline, carries access and unit metadata
+explicitly, and is what the ModioHub catalog publishes. modpoll does not call an AI service at runtime.
+
+Convert configurations to profile 0.2 as described in the [modpoll-wot profile](../reference/modpoll-wot/profile.md).
+Profile 0.1 is rejected; migrate its member mapping into Forms and use physical bit addresses. Check the
+executable profile and bundled schemas before using a conversion.
+
+## Field mapping
+
+- Copy the device name to `title` and pass its Unit ID through `--unit-id`.
+- Preserve every poll's table, literal start address, quantity and byte/word order.
+- Map each property to a Modbus Form with its raw table, literal address, quantity, type and byte/word order.
+ List properties in the matching acquisition group to preserve the original block boundaries and polling
+ order. Offsets are derived from Forms and count physical bits for Coil/DiscreteInput.
+- Express read-only and write-only references through `readOnly` and `writeOnly`. Neither flag means
+ read/write. DI and IR are read-only tables; their historical `rw` sample flags must become `readOnly: true`.
+- Copy units unchanged and express the old scale as `modpoll:multiplier`. Multipliers keep the existing
+ floating-point execution behavior; they are not interpreted as divisors. Zero and negative multipliers are
+ valid.
+- Preserve effective point names from legacy `ref` rows: the old loader replaced spaces with underscores.
+ Unknown types or ambiguous fields require review.
+
+## Procedure
+
+1. Preserve the original CSV and known raw and output samples. Split multiple device sections into separate
+ JSON files; give each one its effective device name as `title` and its default Unit ID as root
+ `modv:unitID`.
+2. Copy every declared block, including holes. JSON addresses are literal PDU integers: convert a hexadecimal
+ literal to its numeric value; never subtract 30001/40001 or guess a zero/one-based correction.
+3. Translate references into standard property schemas and Modbus Forms. Preserve the effective v1 output key
+ (ASCII spaces became underscores), case and punctuation. List each property in the matching
+ `modpoll:acquisition` block to preserve request boundaries and poll order.
+4. Copy type, unit and scale. `modpoll:multiplier` multiplies the decoded value; it is not a divisor. Zero and
+ negative values are valid. A numeric multiplier uses the existing float behavior even if its literal is
+ stored as a decimal string. String and bit-group scales that v1 ignored require an explicit review note.
+5. Express access with `readOnly` / `writeOnly`; neither means read/write. DI/IR must be readOnly even when an
+ old sample says rw. Preserve raw command expectations: these flags do not authorize or block MQTT address
+ writes.
+6. Validate every output file offline, then compare known vectors and requests. Review the report before using
+ the file on a device. A successful schema check alone cannot certify a vendor register map.
+
+```bash
+modpoll-wot validate meter.tm.json --profile
+modpoll --once --config meter.tm.json --tcp HOST --tcp-port PORT --export data.json
+modpoll --config first.tm.json second.tm.json --tcp HOST
+```
+
+The last command uses each file's Unit ID unless `--unit-id` is given. Each file creates its own client
+connection; connection pooling is not added. A concrete TD's Form Unit IDs must agree with the selected
+instance. Prefer an unbound TM when connection information is not supplied; do not invent reachable HTTP or
+Modbus endpoints merely to produce a TD.
+
+## Reusable AI prompt
+
+Provide the source CSV, the current [profile](../reference/modpoll-wot/profile.md) and the extension schema
+alongside this prompt. The AI may prepare files, but an operator still verifies the result:
+
+```text
+Convert the supplied v1 modpoll CSV into the current executable WoT TM 1.1
+profile 0.2. Read the supplied profile.md and acquisition schema first. This
+task changes configuration format; do not redesign addresses or sampling.
+
+Output:
+- One strict JSON *.tm.json file per device, with unique effective titles,
+ root modv:unitID, tm:ThingModel type and the exact supported contexts.
+- A separate migration report listing every original device, block and ref,
+ its new field/property, any corrected access flag, and unresolved issues.
+- Equivalent modpoll CLI commands and the exact validation commands/results.
+ If you cannot run them, explicitly say "not executed".
+
+Preserve every poll block's order, table, literal start, quantity and holes.
+Map coil/discrete_input/input_register/holding_register to the documented
+modv:entity terms. Put raw type and literal address/quantity on each Modbus
+Form, and list the original polling groups under modpoll:acquisition.
+BE_BE/BE_LE/LE_BE/LE_LE map respectively to byte/word flags true/true,
+true/false, false/true, false/false.
+
+Preserve each effective ref key: v1 replaced ASCII spaces with underscores;
+do not change case, punctuation or hyphens. Preserve every block's order,
+start and quantity without converting to per-property polling.
+Bit-table offsets count eight-bit groups; register offsets count registers
+only when the selected profile uses member offsets.
+address:bit is allowed only for a register bool bit 0..15. Strings count bytes.
+Numeric/string bit-table members must fit complete requested payload bytes;
+do not rely on padded response bits. Preserve the documented legacy bit-table
+numeric packing rather than inventing a new byte/word transformation.
+
+Normalize table/type/access tokens to lowercase, as v1 did; a blank access
+field defaults to r. Preserve type widths and unit labels. Copy scale as modpoll:multiplier, including
+zero, negative and fractional literals. Do not replace multiplication by a
+guessed vendor gain/divisor. Use number schemas for float/scaled numeric
+output, integer for unscaled integers, string for stringN, boolean for a
+selected register bit, and boolean arrays for bool groups.
+
+Translate r/w/rw to the standard property access flags. DI/IR are read-only:
+report old rw flags and the correction. Do not claim these flags add raw
+MQTT write authorization or inverse engineering-value encoding.
+
+Do not guess unknown types, invalid rw tokens, incomplete rows or duplicate
+effective names. Do not silently omit anything to make validation pass.
+If a decision is needed, mark the separate report as blocked/needs-review
+and explain it; keep reports and unsupported fields out of executable JSON.
+A TD is optional only when explicit instance endpoint parameters are supplied;
+Forms must agree with the group/member mapping and selected Unit ID.
+
+Check every source ref is accounted for. Run the offline validator, compare
+group requests, and compare provided raw/engineering-value vectors. Passing
+structural validation is not evidence of real-device correctness.
+```
+
+## Review checklist
+
+- Every device and ref is accounted for; duplicate names and aliases are reviewed.
+- Table, literal address, count and byte/word flags match the source blocks.
+- Offsets and full type spans fit each block; no accidental per-property polling.
+- Units, multiplier direction, zero scales and large-integer expectations match.
+- Access corrections and rejected source mistakes are explicit in the report.
+- All JSON files pass the offline profile validator; independent vectors and output comparisons pass. Unknown
+ vendor facts remain unresolved, not guessed.
+- No AI calls or device-library dependency are introduced at conversion time.
+
+The authored `examples/modsim.tm.json` / `modsim.generated.td.json` pair and the independent vectors in the tests
+demonstrate the process. Migrating the entire `contrib` tree is not a release condition.
diff --git a/docs/guide/quickstart.md b/docs/guide/quickstart.md
new file mode 100644
index 0000000..449af94
--- /dev/null
+++ b/docs/guide/quickstart.md
@@ -0,0 +1,36 @@
+# Quickstart
+
+Use the public Modbus TCP simulator at `modsim.topmaker.net:502` to try modpoll without starting a local server:
+
+```bash
+modpoll --once --tcp modsim.topmaker.net --tcp-port 502 --config examples/modsim.tm.json
+```
+
+## Run a local simulator
+
+Start a local [modsim](simulate-a-device.md) simulator in one terminal:
+
+```bash
+docker run --rm -p 5020:5020 topmaker/modsim:latest
+```
+
+In another terminal, poll its sample data once:
+
+```bash
+modpoll --once --tcp 127.0.0.1 --tcp-port 5020 --config examples/modsim.tm.json
+```
+
+The command assumes you are in the `packages/modpoll` directory of the repository. You can instead provide the
+published configuration URL or your own local TM/TD JSON file.
+
+The simulator's default datastore uses literal Modbus addresses:
+
+| Table | Access | Addresses |
+| --- | --- | --- |
+| Coils | Read/write | 0–31 |
+| Discrete inputs | Read-only | 10000–10031 |
+| Input registers | Read-only | 30000–30043 |
+| Holding registers | Read/write | 40000–40043 |
+
+Coil and discrete input blocks contain 32 bits including padding. All Unit IDs share the default simulator
+datastore. See [simulate a device](simulate-a-device.md) for other transports and their limits.
diff --git a/docs/guide/read-a-device.md b/docs/guide/read-a-device.md
new file mode 100644
index 0000000..fd813aa
--- /dev/null
+++ b/docs/guide/read-a-device.md
@@ -0,0 +1,85 @@
+# Read a device
+
+modpoll reads the device that a Thing Model describes. `--config` takes a local TM/TD file, an HTTPS URL or a
+`modiohub:@` Workspace reference; see [configuration](../reference/modpoll/configuration.md). Each
+model describes one device; pass several `--config` paths for several devices. All options are listed in the
+[command-line reference](../reference/modpoll/cli.md).
+
+## Examples
+
+Connect to a Modbus TCP device:
+
+```bash
+modpoll --tcp 192.168.1.10 --config examples/modsim.tm.json
+```
+
+Connect to a Modbus serial device:
+
+```bash
+modpoll --serial /dev/ttyUSB0 --serial-baud 9600 --config examples/modsim.tm.json
+```
+
+Connect to a Modbus TCP device and publish the data to a remote MQTT broker:
+
+```bash
+modpoll --tcp 192.168.1.10 --config examples/modsim.tm.json --mqtt-host broker.emqx.io
+```
+
+Connect to a Modbus TCP device and export a local JSON snapshot:
+
+```bash
+modpoll --tcp 127.0.0.1 --tcp-port 5020 --config examples/modsim.tm.json --export data.json
+```
+
+Replay an exported snapshot with modsim on this computer. A snapshot is
+[simulation data](../reference/modpoll-wot/profile.md#simulation-data) as it stands; points that were not read
+keep their defaults. It holds readings of a real device, so keep it local:
+
+```bash
+modpoll --once --tcp 192.168.1.10 --config examples/modsim.tm.json --export snapshot.json
+modsim --config examples/modsim.tm.json --port 5020 --data snapshot.json
+```
+
+## Value rendering
+
+The terminal table, the MQTT payload and the JSON snapshot show one number for one reading. The default
+`--precision auto` keeps the precision the source data carries:
+
+- A register value with a `modpoll:multiplier` is shown as its exact decimal, so `2301` scaled by `0.1` reads
+ `230.1` rather than `230.10000000000002`.
+- A `float16` or `float32` register is shown as the shortest decimal that reads back as the same value at that
+ width, so `12.34` stays `12.34`.
+- A `float64` register keeps its full value.
+- Integers, booleans and strings are shown unchanged.
+
+An explicit `--precision N` rounds every float to at most `N` decimals:
+
+```bash
+modpoll --tcp 192.168.1.10 --config examples/modsim.tm.json --precision 2
+```
+
+Rounding a scaled reading can change the raw register value it names. The exported snapshot doubles as modsim
+simulation data, so modpoll logs a warning when that happens. The value is still written as asked for.
+
+## Framers and transports
+
+- Serial (`--serial`, alias `--rtu`) supports the framers `rtu` and `ascii` (for example
+ `--serial ... --framer ascii`). With `--framer default`, pymodbus uses RTU. The binary framer was removed in
+ pymodbus 3.9. pyserial URLs such as `socket://host:port` and `rfc2217://host:port` work for serial-over-TCP
+ tunnels.
+- TCP and UDP (`--tcp`, `--udp`) use the `socket` framer; other framers are rejected.
+
+## MQTT data and writes
+
+The default topics use the model's `title`: `modpoll//data` for samples and `modpoll//set` for
+write commands. The publish, subscribe and diagnostics topic patterns are configurable.
+
+Writes use literal Modbus PDU addresses and raw values. Holding-register arrays use FC16 and must contain 1–123
+unsigned 16-bit values within the address range. Malformed payloads, invalid or oversized values, ambiguous
+device names and retained messages are ignored and logged. Brokers can clear the retained flag on live
+forwarding, so configure the broker not to retain messages on the set topic; QoS does not make a write exactly
+once.
+
+Points that fail in a poll cycle are omitted from the MQTT output and written as `null` in the JSON snapshot.
+Snapshots from several configuration files are combined and replaced atomically. With `--timestamp`, the
+timestamp is the start of the poll cycle in Unix seconds; a device with a point named `timestamp` cannot use it.
diff --git a/docs/guide/simulate-a-device.md b/docs/guide/simulate-a-device.md
new file mode 100644
index 0000000..7a6386d
--- /dev/null
+++ b/docs/guide/simulate-a-device.md
@@ -0,0 +1,83 @@
+# Simulate a device
+
+modsim runs simulated Modbus devices for development and integration testing. It reads profile 0.2 TM/TD input
+and [simulation data](../reference/modpoll-wot/profile.md#simulation-data), and runs independent devices on one
+Modbus TCP listener. Models, simulation data, the simulator and the client stay separate. Simulation is not
+evidence of physical device behavior.
+
+## One device
+
+```bash
+modsim --config device.tm.json --port 5020 --data device.data.json
+```
+
+Without `--port`, modsim listens on 5020, so the first command needs no administrator rights; read it with
+`modpoll --tcp 127.0.0.1 --tcp-port 5020`. Linux, and macOS when binding to `127.0.0.1`, reserve ports below
+1024 for administrators: to listen on the standard port 502, run the command with sudo (with uvx,
+`sudo "$(command -v uvx)" modsim --port 502 ...`). modsim prints the same hint when a port is refused. Windows does
+not reserve these ports.
+
+A modpoll `--export` snapshot is simulation data too, so a device read once can be replayed locally. Snapshots
+hold readings of a real device; keep them on your computer:
+
+```bash
+modpoll --config device.tm.json --tcp 192.168.1.10 --once --export snapshot.json
+modsim --config device.tm.json --port 5020 --data snapshot.json
+```
+
+See [model-driven simulation](../reference/modsim/model-driven-simulation.md) for the supported profile, codecs,
+constraints and behavior scripts.
+
+## Modbus RTU
+
+`--serial pty` simulates a Modbus RTU device without hardware (Linux and macOS). modsim creates a virtual serial
+cable, prints the port for the client and the matching modpoll command, and removes it on exit:
+
+```bash
+modsim --config device.tm.json --serial pty
+# Virtual serial port for the client: /dev/pts/7
+# Read it with: modpoll --config device.tm.json --serial /dev/pts/7 --serial-baud 9600
+```
+
+Virtual ports ignore baud rate and parity, so `--serial-baud` and `--serial-parity` only shape the printed
+command. `--serial-link PATH` adds a fixed symbolic link to the client port. Pass a port name instead of `pty` to
+listen on an existing serial port with those settings. Windows has no pseudo-terminals: create a virtual serial
+pair with a driver such as com0com, listen on one port with `--serial COM5` and connect the client to the other.
+`--serial` and `--port` are mutually exclusive.
+
+The single-device model runtime supports TCP and Modbus RTU.
+
+## Several devices
+
+A managed deployment runs several devices on one listener from a YAML file and updates them while running.
+`examples/deployment.yaml` in the modsim source starts two virtual ADAM devices: Unit 1 exposes ADAM-5017UH raw
+inputs; Unit 2 exposes ADAM-6024 raw I/O with synthetic AO→AI and DO→DI loopback.
+
+```bash
+modsim up -f examples/deployment.yaml -d
+modsim ps -f examples/deployment.yaml
+modsim down -f examples/deployment.yaml
+```
+
+Managed commands require POSIX (Linux, macOS or WSL). See
+[managed deployments](../reference/modsim/managed-deployments.md) for the file format, updates, logging, TD export
+and Docker Compose.
+
+## Models in your ModioHub Workspace
+
+After `modsim login` (see [signing in](verification-reports.md#sign-in-to-modiohub)),
+`--config modiohub:@` simulates one of your custom Thing Models, or a shared one without signing in;
+the download is checked against the SHA-256 the server states. Deployment files do not take `modiohub:` models,
+so a hosted deployment never carries your login.
+
+```sh
+modsim --config modiohub:k3x9f2m7q4a8n5bd@latest --port 5020
+```
+
+## Unconfigured demo
+
+`modsim --comm tcp --port 5020` starts the legacy demonstration datastore; all Unit IDs share its four Modbus
+tables. TCP and UDP use socket framing; UDP listens on loopback. TLS loads `certificates/pymodbus.crt` and
+`certificates/pymodbus.key` from the working directory and does not authenticate clients. Serial supports RTU
+and ASCII; physical serial hardware has not been validated by the local regression suite. The CLI rejects a
+non-default `--store` and the unsupported `--slaves` and `--context` options.
diff --git a/docs/guide/verification-reports.md b/docs/guide/verification-reports.md
new file mode 100644
index 0000000..b4fb394
--- /dev/null
+++ b/docs/guide/verification-reports.md
@@ -0,0 +1,59 @@
+# Verification reports
+
+Adding `--report` to a normal read verifies a Thing Model on real hardware. Every point is read once, read-only,
+without retries and with a timeout of at most 10 seconds, so a lost request is a result and not something to
+repeat. `--report FILE` writes the verification report (`-` prints it); a bare `--report` asks where to save,
+whether the values look right, and whether to upload:
+
+```sh
+modpoll --config examples/modsim.tm.json --tcp 192.168.1.20 --unit-id 3 --report report.json
+```
+
+The report records, for each point, whether the read worked (`ok`, a Modbus `exception` with its code,
+`no-response`, or `not-tested` when the answer could not be decoded) and your judgment of the value:
+`--confirm POINT...` (or `all`) and `--reject POINT...` for values you compared with the device, otherwise
+`unchecked`. The report holds no address, Unit ID, serial number or value; review it before sharing. Check it
+with `modpoll-wot validate-report report.json --model model.tm.json` (see the
+[report schema](../reference/modpoll-wot/profile.md#verification-reports)). `--export` still writes the snapshot
+of the same read.
+
+A point whose DataSchema declares `const` (an identity point, such as a meter code) is compared with the value
+read, and the report records only `match` or `mismatch`.
+
+When a read fails, modpoll lists each failed group as the device answered it, without guessing why:
+
+```text
+Group 3 of 8 (holding registers 40-59): exception code 02 (illegal data address).
+Group 5 of 8 (input registers 0-59): no response.
+Groups 6-8 of 8: not tried.
+Not a full read: 21 of 44 points read.
+```
+
+## Upload to ModioHub
+
+Only a full read whose identity points match can be uploaded. Any other report is saved for your own checks or a
+catalog request, and `--upload` refuses it without contacting ModioHub. The exit code is 1 unless the report can
+be uploaded.
+
+ModioHub identifies the product from the model fingerprint. When it does not know the model, modpoll names the
+product whose baseline Thing Model holds all of the report's points, or lets you choose one from the matched
+products or a search, and otherwise prints a prefilled catalog request.
+
+`modpoll --config ... --upload` shows the report and, after you confirm (or with `--yes`), uploads it. Without a
+login the sign-in flow starts right there:
+
+```sh
+modpoll --config modiohub:k3x9f2m7q4a8n5bd@latest --tcp 192.168.1.20 --upload
+```
+
+## Sign in to ModioHub
+
+`modpoll login` (or `modsim login`) signs in with your browser: it prints a code and an address (and opens the
+address where a browser can open), you confirm the code there, and the 7-day tool session is kept in a file only
+you can read (`~/.config/modiohub/credentials.json`, or `%APPDATA%\modiohub` on Windows). Both tools use the same
+file, so signing in with either signs in both. `MODIOHUB_TOKEN` in the environment replaces the file for scripts,
+`MODIOHUB_URL` selects another server, and `login` and `logout` take `--server URL` for the same. `logout` forgets
+the login on this computer; revoke the session in your ModioHub settings to end it on the server.
+
+Once signed in, `--config modiohub:@` (the version is a number or `latest`) reads one of your custom
+Thing Models. A shared one needs no login. Verifying it names the Workspace model in the report.
diff --git a/packages/modpoll/docs/site/assets/modpoll-usage.png b/docs/images/modpoll-usage.png
similarity index 100%
rename from packages/modpoll/docs/site/assets/modpoll-usage.png
rename to docs/images/modpoll-usage.png
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..ba143af
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,61 @@
+# modpoll, modsim and modpoll-wot
+
+Three tools that read, simulate and describe Modbus devices with W3C WoT Thing Models. Each is released to
+PyPI on its own:
+
+- **modpoll** reads Modbus TCP and RTU devices from a Thing Model, publishes readings to MQTT and writes
+ verification reports.
+- **modsim** simulates a Modbus device from a Thing Model, over TCP or a virtual serial port.
+- **modpoll-wot** holds the executable Thing Model profile, fingerprints and report schemas that both tools share.
+
+```{image} images/modpoll-usage.png
+:alt: modpoll polls Modbus devices and publishes the readings to an MQTT broker
+```
+
+Start with [installation](guide/installation.md) and the [quickstart](guide/quickstart.md). ModioHub accounts,
+device authorization and report uploads on the platform side are documented on ModioHub.
+
+```{toctree}
+:caption: Guides
+:maxdepth: 1
+:hidden:
+
+guide/installation
+guide/quickstart
+guide/read-a-device
+guide/simulate-a-device
+guide/verification-reports
+guide/migrate-from-v1-csv
+```
+
+```{toctree}
+:caption: modpoll
+:maxdepth: 1
+:hidden:
+
+reference/modpoll/cli
+reference/modpoll/configuration
+reference/modpoll/v1-compatibility
+reference/modpoll/changelog
+```
+
+```{toctree}
+:caption: modsim
+:maxdepth: 1
+:hidden:
+
+reference/modsim/cli
+reference/modsim/model-driven-simulation
+reference/modsim/managed-deployments
+reference/modsim/changelog
+```
+
+```{toctree}
+:caption: modpoll-wot
+:maxdepth: 1
+:hidden:
+
+reference/modpoll-wot/cli
+reference/modpoll-wot/profile
+reference/modpoll-wot/contract
+```
diff --git a/docs/reference/modpoll-wot/cli.md b/docs/reference/modpoll-wot/cli.md
new file mode 100644
index 0000000..3190940
--- /dev/null
+++ b/docs/reference/modpoll-wot/cli.md
@@ -0,0 +1,37 @@
+# Command line
+
+modpoll-wot checks Thing Models (TM), Thing Descriptions (TD), simulation data and verification reports offline,
+and creates and exports Thing Models. It executes no Modbus requests.
+
+```sh
+modpoll-wot new --title "meter"
+modpoll-wot validate meter.tm.json
+modpoll-wot validate meter.tm.json --kind tm --profile
+modpoll-wot export meter.tm.json --host 127.0.0.1 --port 5020 --unit-id 7 -o meter.td.json
+modpoll-wot validate meter.td.json
+modpoll-wot fingerprint meter.tm.json
+modpoll-wot validate-report report.json --model meter.tm.json
+modpoll-wot validate meter.data.json --kind data
+```
+
+Validation reports each check separately with a tick or cross and an error detail on failure. Terminal markers
+are colored; redirected output has no ANSI colors, and `NO_COLOR` disables colors. The exit status is zero only
+on success. Structure validation is offline and rejects duplicate JSON keys; it does not check JSON-LD,
+references, device behavior or complete W3C conformance. The kind is detected from the document, so use
+`--kind tm` for a known TM whose type might be missing. `--profile` checks the executable subset, accepting
+instance options and `--param NAME=JSON` when needed.
+
+`new` writes `.tm.json` in the current directory by default; use `-o` to choose another path. It never
+overwrites a file. The starter is a standard TM skeleton; add [profile 0.2](profile.md) mappings before
+executable validation or export. Export accepts `--target node-wot-0.9.2` for the documented subset and never
+overwrites files.
+
+The loader validates the bundled W3C TM/TD 1.1 schemas, the project extension schema and acquisition semantics.
+The bundled W3C schemas identify themselves as 1.1-12-March-2025, retrieved from
+ and . Standard
+validation does not establish device correctness.
+
+```{argparse}
+:ref: modpoll_wot.__main__.get_parser
+:prog: modpoll-wot
+```
diff --git a/docs/reference/modpoll-wot/contract.md b/docs/reference/modpoll-wot/contract.md
new file mode 100644
index 0000000..5181e36
--- /dev/null
+++ b/docs/reference/modpoll-wot/contract.md
@@ -0,0 +1,3 @@
+```{include} ../../../packages/modpoll-wot/CONTRACT.md
+:relative-docs: ../../../packages/modpoll-wot/
+```
diff --git a/docs/reference/modpoll-wot/profile.md b/docs/reference/modpoll-wot/profile.md
new file mode 100644
index 0000000..42767c8
--- /dev/null
+++ b/docs/reference/modpoll-wot/profile.md
@@ -0,0 +1,3 @@
+```{include} ../../../packages/modpoll-wot/profile.md
+:relative-docs: ../../../packages/modpoll-wot/
+```
diff --git a/docs/reference/modpoll/changelog.md b/docs/reference/modpoll/changelog.md
new file mode 100644
index 0000000..962bc0c
--- /dev/null
+++ b/docs/reference/modpoll/changelog.md
@@ -0,0 +1,2 @@
+```{include} ../../../packages/modpoll/CHANGELOG.md
+```
diff --git a/docs/reference/modpoll/cli.md b/docs/reference/modpoll/cli.md
new file mode 100644
index 0000000..ccca6fc
--- /dev/null
+++ b/docs/reference/modpoll/cli.md
@@ -0,0 +1,6 @@
+# Command line
+
+```{argparse}
+:ref: modpoll.arg_parser.get_parser
+:prog: modpoll
+```
diff --git a/docs/reference/modpoll/configuration.md b/docs/reference/modpoll/configuration.md
new file mode 100644
index 0000000..f9aac40
--- /dev/null
+++ b/docs/reference/modpoll/configuration.md
@@ -0,0 +1,66 @@
+# Configuration
+
+modpoll accepts JSON configurations using WoT TM/TD 1.1 and the v1 CSV format. `-f`/`--config` takes either
+format and detects it from the content, not the file name or URL suffix: a first non-whitespace byte of `{` or
+`[` selects JSON; anything else is parsed as v1 CSV. The same argument also accepts a
+`modiohub:@` reference to a custom Thing Model in your ModioHub Workspace (run `modpoll login` first
+unless the version is shared); a reference is always a Thing Model. `--config` is the only configuration
+argument; there are no format-specific flags.
+
+For JSON input, a top-level `@type` containing `tm:ThingModel` (a string or an array entry) selects TM
+validation; otherwise the document is validated as TD. An invalid document fails its selected validation; the
+loader does not retry it as the other format. This preview supports the fixed `tm:ThingModel` spelling, without
+resolving alternate JSON-LD aliases.
+
+The v1 CSV row format (`device`, `poll` and `ref` rows) keeps its original semantics: point names replace ASCII
+spaces with underscores, a blank access column defaults to `r`, the scale column multiplies the decoded value,
+and bit-table point addresses identify eight-bit groups. `--unit-id` overrides the per-device ID column;
+`--param` placeholder bindings require a Thing Model and are rejected for CSV. The canonical
+`examples/modsim.csv` produces the same four blocks and 37 points as `examples/modsim.tm.json`. Only profile 0.2
+is accepted; older profiles must be migrated. Details are in the
+[modpoll-wot profile](../modpoll-wot/profile.md).
+
+Each file describes one device. Its `title` is the output device name; `--unit-id` overrides the instance Unit
+ID (range 1–254). Without it, each file uses the Unit ID declared consistently in its Forms, falling back to 1.
+Different files can therefore address different Unit IDs in one process. Several files may be passed to
+`--config`; device names must be unique across all files. The transport arguments explicitly select the
+connection endpoint. A concrete TD's form Unit IDs, addresses and quantities must agree with the model.
+
+The interpreter validates the official, locally bundled TD/TM 1.1 schema, the project extension schema and
+cross-field acquisition semantics. It does not fetch context files or schemas. The local and URL input limit is
+1 MiB and the JSON nesting limit is 64. Duplicate JSON keys and non-finite numbers are rejected.
+
+Profile 0.2 places standard types, access flags and units on properties, and standard Modbus Forms carry each
+property's raw mapping. `modpoll:acquisition` preserves declared block boundaries, order and holes. Profile 0.1
+input is rejected rather than translated or silently accepted. These acquisition semantics are a project
+extension, not a W3C standard. The selected subset does not execute arbitrary TD protocol bindings.
+
+The executable contract and its test vectors live in modpoll-wot ([profile](../modpoll-wot/profile.md),
+[contract](../modpoll-wot/contract.md)). Strings, bit selectors, four tables and all four byte/word orders are
+represented by the contract. Model inheritance, optional members, URI templates, non-Modbus forms and security
+schemes other than `nosec` are rejected in this preview subset. The interpreter records access flags; raw MQTT
+write commands keep the 1.x behavior and are not property-based writes.
+
+Standard schema validity alone does not establish device correctness or prove that a general WoT consumer will
+implement the project's acquisition and transform extensions. See
+[v1 compatibility](v1-compatibility.md) for intentional fixes and
+[migrating from v1 CSV](../../guide/migrate-from-v1-csv.md) for the conversion procedure.
+
+## Standard Form profile 0.2
+
+The shared modpoll-wot package provides profile 0.2 with standard Form mappings and explicit blocks; modpoll uses
+an exact published modpoll-wot version. See the [profile](../modpoll-wot/profile.md) for API details, parameter
+precedence, necessary extensions and external consumer limits. The source example is
+`examples/modsim.tm.json`, with its generated local TCP instance `examples/modsim.generated.td.json`; both keep
+the four original blocks and 37 output references. Generated TDs are instance artifacts.
+
+## Register bits in CSV
+
+For register references (holding or input registers) with a `dtype` of `bool`, a v1 CSV configuration can
+extract a single bit from the 16-bit register by appending `:bit` to the address, where `bit` is an integer from
+0 to 15:
+
+- `40110` reads the whole 16-bit register at address 40110.
+- `40110:15` reads the register at address 40110, extracts bit 15 and returns a boolean.
+
+The bit is extracted from the final 16-bit value, after byte and word swapping by the poller's endianness.
diff --git a/docs/reference/modpoll/v1-compatibility.md b/docs/reference/modpoll/v1-compatibility.md
new file mode 100644
index 0000000..f722556
--- /dev/null
+++ b/docs/reference/modpoll/v1-compatibility.md
@@ -0,0 +1,29 @@
+# v1 compatibility
+
+The v2 change adds the executable TM/TD profile alongside the retained v1 CSV loader. `--config` is the single configuration argument and detects the format from the content. The existing transport, decoder, output and raw write paths remain. This table compares the pinned v1 baseline `0b42099` with the v2 implementation; it is not a claim that all WoT documents or every operating system has been validated.
+
+| Capability | v2 disposition | Evidence / limit |
+| --- | --- | --- |
+| Existing CLI | Existing transport, rate, interval, output and MQTT arguments retained; `--unit-id` adds an explicit override. v1 CSV configurations load through the same `--config` argument, detected from the content. | `test_framer_validation.py`, `test_csv_config.py` and existing CLI tests. No automatic connection from TM Forms is introduced; a concrete TD still supplies its endpoint. |
+| Multiple devices/configurations | One Thing per file; split an old multi-device CSV into several JSON files. Per-file Unit IDs and unique titles are retained. | `test_modbus_task.py` and `test_wot_reading_interop.py`. An invalid file is closed while other valid files continue, matching the existing policy. |
+| Poll blocks, gaps and addressing | Ordered groups, literal PDU addresses, quantities and gaps preserved. | `verify_modsim_equivalence.py` compares exact requests and 37 values. |
+| Numeric/register bit/string types | Register integer/float widths, bit selectors, odd strings, units and multipliers retained; unscaled large integers remain Python integers. | Independent struct vectors in all four byte/word orders. Multiplied values still use the existing floating-point execution semantics. |
+| Value rendering | The console table, the MQTT payload and the JSON snapshot show one number for one reading. `--precision auto` keeps the precision the source data carries; `--precision N` rounds every float to at most `N` decimals. | Intentional change: v1 rounded console and MQTT values to three decimals but wrote raw floats to the export, so one reading had two renderings and a scaled value of `0.0001` read as `0.0`. Cross-version comparisons now compare values rather than bytes. |
+| Numeric/string references in bit tables | Restored for complete payload bytes. Offsets remain eight-bit groups; numeric width counts bytes, stringN counts N bytes. | `test_m3_compatibility.py` and actual v1/TM numeric-bit parity tests. Incomplete numeric/string spans now fail validation, rather than decoding protocol padding or failing later. As in v1, bit-table numeric assembly reverses bit order within a byte; word order is not applied to bit tables. |
+| Aliases and overlapping views | Distinct property names can decode the same address; every alias is kept. Duplicate property membership is still rejected. | v1 could silently omit same-address aliases. This is an intentional fix; `test_aliases_decode_every_property_from_one_read` checks both views from one physical request. |
+| Read/write metadata | Readable properties are decoded; writeOnly properties are omitted from telemetry and remain null in snapshots. Declared blocks still get read. | DI/IR are read-only. Raw MQTT address writes do not inherit property-level authorization or engineering-value inverse transforms. |
+| UDP | Existing socket transport retained; explicit socket framer fixed. | Real simulator comparison of v1 CSV and the unbound 0.2 TM output. |
+| Serial RTU / ASCII | Serial and `--rtu` alias retained, explicit framer uses the actual PyModbus enum API instead of rejected class arguments. | POSIX PTY tests use the unbound 0.2 TM and verify full outputs and independently computed CRC/LRC request bytes. Default RTU matches v1. The pinned v1 explicit ASCII path fails construction, so ASCII is checked against independent wire/data expectations rather than claiming false v1 equivalence. |
+| MQTT protocol/output/commands | 3.1.1 and 5.0, grouped JSON, individual topics, diagnostics and existing FC5/6/16 commands retained. | Private-broker CSV/TM/TD matrix for QoS0/1; TLS/QoS2 CLI tests cover both protocols, both output styles, and command readback. |
+| MQTT TLS / authentication | Existing TLS version, CA, credentials and explicit insecure option retained. | Disposable CA/server certificates verify trusted success, unknown CA, hostname mismatch and bad-password refusal. Insecure bypass is explicit. |
+| Failures, counts and snapshots | Short responses invalidate missing values; connect/transport failures count once per active group. Disabled autoremove groups do not add attempts. | Real stop/restart and short-response cases. Invalid values are omitted from MQTT and null in atomic JSON snapshots; existing fsync/replace failure tests remain. |
+| One-shot exit status | A failed group or JSON export makes `--once` exit nonzero after cleanup. | Intentional correction: v1 could report exit 0 despite failed sampling or export. Signal-driven shutdown remains graceful. |
+| MQTT shutdown / outbound queue | Accepted publications get a bounded flush window (default five seconds), then disconnect precedes joining the network loop. Outstanding messages are reported; the outgoing queue is bounded to 1000 entries. | A real peer withholding PUBACK verifies shutdown cannot wait indefinitely. QoS handshakes do not make raw Modbus writes idempotent. |
+
+## Current boundaries
+
+CSV runtime support is retained, so v1 configurations and commands keep working; new configurations should still prefer profile 0.2 (see [migrating from v1 CSV](../../guide/migrate-from-v1-csv.md)). Strings and bit arrays carrying meaningless numeric scales, invalid rw modes, unknown types and incomplete payload spans require review rather than silent conversion. Profile inheritance/templates/actions and new property-based writes are separate features, not requirements for preserving the old tool.
+
+Automated serial acceptance uses POSIX virtual terminals. On 2026-10-28 the maintainer also confirmed successful polling of an Eastron meter over physical RS485. This manual result covers that tested setup; Windows/macOS serial hardware and other device setups retain their own validation scope. The automated CI matrix remains Python 3.10–3.12 on Linux.
+
+The functional preview `2.0.0a1` and independent `modpoll-wot==0.1.0a1` are published. Application dependencies use the exact registry version; wheel/sdist, Docker and registry-installed acceptance have passed. See the [validation record](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll/docs/validation.rst) for release and hardware evidence.
diff --git a/docs/reference/modsim/changelog.md b/docs/reference/modsim/changelog.md
new file mode 100644
index 0000000..7bba878
--- /dev/null
+++ b/docs/reference/modsim/changelog.md
@@ -0,0 +1,2 @@
+```{include} ../../../packages/modsim/CHANGELOG.md
+```
diff --git a/docs/reference/modsim/cli.md b/docs/reference/modsim/cli.md
new file mode 100644
index 0000000..6ab43bd
--- /dev/null
+++ b/docs/reference/modsim/cli.md
@@ -0,0 +1,16 @@
+# Command line
+
+`modsim` runs one simulated device from flags. The managed commands (`up`, `down`, `ps`, `logs`, `export`,
+`reset`) run a [deployment](managed-deployments.md) of several devices on one listener.
+
+```{argparse}
+:ref: modsim.utils.get_parser
+:prog: modsim
+```
+
+## Managed commands
+
+```{argparse}
+:ref: modsim.commands.parser
+:prog: modsim
+```
diff --git a/packages/modsim/docs/site/managed-deployments.md b/docs/reference/modsim/managed-deployments.md
similarity index 70%
rename from packages/modsim/docs/site/managed-deployments.md
rename to docs/reference/modsim/managed-deployments.md
index cab2b53..2610e6c 100644
--- a/packages/modsim/docs/site/managed-deployments.md
+++ b/docs/reference/modsim/managed-deployments.md
@@ -1,8 +1,7 @@
# Managed deployments
-The 2.0.0a2 candidate adds two-level commands for a local, single-listener
-deployment. These commands are not included in the published `2.0.0a1` preview.
-Managed commands currently require POSIX (Linux, macOS or WSL); the existing
+Managed commands run a local, single-listener deployment of several devices.
+They currently require POSIX (Linux, macOS or WSL); the existing
flag-based server entry point remains available on other platforms.
## Start and reconcile
@@ -78,7 +77,7 @@ The deployment format is a Modsim contract, not a standard TD object. TD generat
uses `modpoll-wot==0.2.0a2` and its bundled TD/Modbus/profile validation. There is
no private TD parser or arbitrary TD patch mechanism.
-`data` names [simulation data](model-validation.md#simulation-data) or a modpoll
+`data` names [simulation data](model-driven-simulation.md#simulation-data) or a modpoll
snapshot. Both JSON and YAML documents are accepted by managed deployments.
There is no duplicate initial-value field in deployment v2. Omitting data
produces valid static initial values from the model. Simulation data is not
@@ -167,3 +166,81 @@ included in this change.
Prepare pinned example inputs from the repository root with
`uv run python tools/fetch-models.py`; see `examples/model-source.yaml`.
+
+## Run with Docker Compose
+
+From the `examples/` directory of the modsim source, build and start the current source:
+
+```bash
+docker compose up -d --build
+docker compose logs -f
+```
+
+Compose publishes Modbus TCP only on host `127.0.0.1:5020` and restarts the container unless stopped. Each
+restart resets simulation state. TDs advertise `127.0.0.1` by default; configure the advertised host and port
+mapping when clients connect from another machine.
+
+The deployment, model and simulation data files are mounted from the repository. `docker compose up -d` starts
+the configured deployment; do not run `modsim up` again just to start it. After editing the mounted deployment
+file, apply it to the running simulator with:
+
+```bash
+docker compose exec modsim python -m modsim up -f /app/deployment.yaml -d
+```
+
+Use the mounted path Compose started (`/app/deployment.yaml`); the control socket rejects any other path. An
+unchanged device keeps its state; a changed device is replaced. Listener changes require a container restart.
+If you replace the deployment file itself, run `docker compose up -d --force-recreate` to refresh its bind
+mount. The Compose file maps the default output directory to the host's `examples/td/`, so this command, run
+from `examples/`, writes one `*.td.json` file per running device there:
+
+```bash
+docker compose exec modsim python -m modsim export --running
+```
+
+Stop the Compose deployment with `docker compose down`.
+
+## Example: read the deployment with modpoll
+
+Export all TDs from the current deployment file; modsim does not need to be running:
+
+```bash
+modsim export
+```
+
+In another terminal, read the exported TD:
+
+```bash
+modpoll --once --interval 0 --tcp 127.0.0.1 --tcp-port 5020 \
+ --config ./output/adam-6024.td.json --export ./adam-6024-snapshot.json
+```
+
+For the last applied configuration of a Docker Compose deployment, use the Compose export command above and
+read `./examples/td/adam-6024.td.json` instead. The TD selects Unit ID 2. On a fresh deployment,
+`adam6024_raw` reports `AO0_RAW: 100` and `AI0_RAW: 100`; values may differ if previously written.
+
+### Optional: write through MQTT
+
+Start a temporary local broker and a continuously running modpoll process:
+
+```bash
+docker run --rm -d --name modpoll-demo-mqtt -p 127.0.0.1:1883:1883 \
+ eclipse-mosquitto:2 mosquitto -c /mosquitto-no-auth.conf
+modpoll --interval 0 --rate 1 --tcp 127.0.0.1 --tcp-port 5020 \
+ --config ./output/adam-6024.td.json --mqtt-host 127.0.0.1 --mqtt-port 1883
+```
+
+After modpoll connects, publish a non-retained write to the topic named for the TD's `title`:
+
+```bash
+docker exec modpoll-demo-mqtt mosquitto_pub -h 127.0.0.1 \
+ -t modpoll/adam6024_raw/set \
+ -m '{"object_type":"holding_register","address":10,"value":432}'
+```
+
+Run the one-shot modpoll command again. `AO0_RAW` and the loopback `AI0_RAW` should both read `432`. This
+synthetic raw value does not verify the physical device's range or behavior. The example broker has no
+authentication and is published only on host loopback; port 1883 must be available.
+
+Stop modpoll with Ctrl+C, stop the broker (`docker stop modpoll-demo-mqtt`), then stop modsim with `modsim down`
+or the Compose deployment with `docker compose down`.
diff --git a/packages/modsim/docs/site/model-validation.md b/docs/reference/modsim/model-driven-simulation.md
similarity index 96%
rename from packages/modsim/docs/site/model-validation.md
rename to docs/reference/modsim/model-driven-simulation.md
index e8ed496..4acfa8f 100644
--- a/packages/modsim/docs/site/model-validation.md
+++ b/docs/reference/modsim/model-driven-simulation.md
@@ -1,7 +1,6 @@
# Model-driven simulation
-The v2 source uses the published, exact `modpoll-wot==0.2.0a2` dependency.
-Install with `uv sync --all-groups`. Model parsing and TM instantiation belong to that
+modsim depends on an exact published modpoll-wot version. Model parsing and TM instantiation belong to that
shared package; Modsim owns state and protocol execution.
## One device
@@ -63,7 +62,7 @@ be unique. Unknown addresses or Unit IDs never inherit another device's state.
## Simulation data
`--data` takes a local path or HTTPS URL of simulation data, defined by
-[modpoll-wot](https://github.com/top-maker/modpoll-wot/blob/main/profile.md#simulation-data).
+[modpoll-wot](../modpoll-wot/profile.md#simulation-data).
Version `"1"` fields:
| Field | Meaning |
diff --git a/packages/modpoll-wot/CONTRIBUTING.md b/packages/modpoll-wot/CONTRIBUTING.md
new file mode 100644
index 0000000..7c38d8f
--- /dev/null
+++ b/packages/modpoll-wot/CONTRIBUTING.md
@@ -0,0 +1,18 @@
+# Contributing to modpoll-wot
+
+modpoll-wot is developed in the [modpoll repository](https://github.com/top-maker/modpoll/tree/v2) together with
+modpoll and modsim, and released with tags `modpoll-wot-v`; see the repository README for the workspace
+and the release flow. Releases `0.3.0a1` to `0.6.0a2` came from a separate modpoll-wot repository (now archived);
+their history was carried over.
+
+Install [mise](https://mise.jdx.dev/installing-mise.html), then run the source tests, build the wheel and sdist,
+and smoke-test the installed wheel:
+
+```sh
+mise trust
+mise install
+mise run check
+```
+
+Released versions and tags are immutable. A failed publish never replaces an existing version: rerun the failed
+job, or release a new version.
diff --git a/packages/modpoll-wot/README.md b/packages/modpoll-wot/README.md
index b7ca21e..fc71e23 100644
--- a/packages/modpoll-wot/README.md
+++ b/packages/modpoll-wot/README.md
@@ -1,97 +1,15 @@
# modpoll-wot (experimental)
-An independently versioned TM/TD configuration interpreter for
-[Modpoll](https://github.com/top-maker/modpoll),
-[Modsim](https://github.com/top-maker/modpoll/tree/v2/packages/modsim) and future compatible consumers.
-No Modbus execution, scheduler or MQTT service is included.
+The executable W3C WoT Thing Model profile that [modpoll](https://pypi.org/project/modpoll/) and
+[modsim](https://pypi.org/project/modsim/) share: offline TM/TD validation, TD export, point and model
+fingerprints, and the schemas of simulation data and verification reports. It executes no Modbus requests.
```bash
uv add --prerelease allow modpoll-wot # or: pip install --pre modpoll-wot
uvx --prerelease allow modpoll-wot validate device.tm.json --profile
```
-Import from `modpoll_wot` only; its submodules are not a public interface. The package ships
-`py.typed`.
+Import from `modpoll_wot` only; its submodules are not a public interface.
-It is developed in the [modpoll repository](https://github.com/top-maker/modpoll/tree/v2/packages/modpoll-wot)
-together with modpoll and modsim, and released with tags `modpoll-wot-v`. Releases `0.3.0a1`
-to `0.6.0a2` came from a separate modpoll-wot repository (now archived); their history was carried over.
-
-The existing TM CLI is available in `modpoll-wot==0.2.0a2`.
-Version `0.5.0a1` adds the shared tool session credentials file and `modiohub:` references (`modpoll_wot.session`).
-Version `0.4.0a1` adds simulation data (`--kind data`) and verification report schema 3.
-Version `0.3.0a3` removes the `modpoll:audit` plan; a full read uses `modpoll:acquisition`.
-Version `0.3.0a2` renames verification report fields to `product` and `chassis` (schema 2).
-Version `0.3.0a1` adds point and model fingerprints and the verification report schema,
-and removes the device metadata schema; see [CONTRACT.md](CONTRACT.md).
-
-```sh
-modpoll-wot new --title "meter"
-modpoll-wot validate meter.tm.json
-modpoll-wot validate meter.tm.json --kind tm --profile
-modpoll-wot export meter.tm.json --host 127.0.0.1 --port 5020 --unit-id 7 -o meter.td.json
-modpoll-wot validate meter.td.json
-modpoll-wot fingerprint meter.tm.json
-modpoll-wot validate-report report.json --model meter.tm.json
-modpoll-wot validate meter.data.json --kind data
-```
-
-Use `modpoll-wot --help` and `modpoll-wot validate --help` for options.
-Validation reports each check separately with a tick or cross and an error
-detail on failure. Terminal markers are colored; redirected output has no ANSI
-colors, and `NO_COLOR` disables colors. The exit status is zero only on success.
-Structure validation is offline and rejects duplicate JSON keys; it does not
-check JSON-LD, references, device behavior or complete W3C conformance. Type is
-detected from the document, so use `--kind tm` for a known TM whose type might
-be missing. `--profile` checks the executable subset, accepting instance options
-and `--param NAME=JSON` when needed. `new` writes `.tm.json` in the current directory by default; use `-o`
-to choose another path. It never overwrites a file. The starter is a standard TM skeleton;
-add profile 0.2 mappings before executable validation or export. Export accepts
-`--target node-wot-0.9.2` for the documented subset and never overwrites files.
-
-See [profile.md](profile.md) for the current profile and
-[CONTRACT.md](CONTRACT.md) for the profile 0.2-only execution policy.
-
-The loader validates bundled W3C TM/TD 1.1 schemas, the project extension
-schema, and acquisition semantics. It does not execute Modbus requests.
-
-```python
-from modpoll_wot.loading import load_model
-model = load_model("meter.tm.json", unit_id=1)
-```
-
-## Development
-
-Install [mise](https://mise.jdx.dev/installing-mise.html), then run the source
-tests, build the wheel and sdist, and smoke-test the installed wheel:
-
-```sh
-mise trust
-mise install
-mise run check
-```
-
-The bundled W3C schemas identify themselves as 1.1-12-March-2025, retrieved from
-https://www.w3.org/2022/wot/td-schema/v1.1 and
-https://www.w3.org/2022/wot/tm-schema/v1.1. Standard validation does not
-establish device correctness.
-
-Version 0.2.0a1 supports [profile 0.2](profile.md): standard Form mappings,
-explicit blocks, per-property decoding and TM-to-TD export. Current development
-source rejects profile 0.1. This compatibility removal is not yet published; use
-a new immutable release version when promoting it, then update consumer pins.
-
-## Releases
-
-Released versions and tags are immutable.
-
-1. On `main`, set `version` in `pyproject.toml` to a new version and merge it
- through a pull request whose CI passes, including the consumer job.
-2. Push the tag `v` at that commit. The release workflow checks the
- tag, tests and builds, publishes to PyPI, verifies the registry installation
- and records a GitHub prerelease with the built files.
-3. Update the exact `modpoll-wot` pin in each consumer repository in its own
- pull request.
-
-A failed publish never replaces an existing version: rerun the failed job, or
-release a new version.
+**Documentation:** ([profile](profile.md),
+[contract](CONTRACT.md)). For development, see [CONTRIBUTING.md](CONTRIBUTING.md).
diff --git a/packages/modpoll-wot/modpoll_wot/__main__.py b/packages/modpoll-wot/modpoll_wot/__main__.py
index 16e9c51..f8f6c1d 100644
--- a/packages/modpoll-wot/modpoll_wot/__main__.py
+++ b/packages/modpoll-wot/modpoll_wot/__main__.py
@@ -47,7 +47,8 @@ def _instance_options(parser):
parser.add_argument("--param", action="append", default=[], metavar="NAME=JSON")
-def main():
+def get_parser():
+ """Build the command-line parser; the documentation site generates its reference from it."""
parser = argparse.ArgumentParser(prog="modpoll-wot", description=__doc__)
commands = parser.add_subparsers(dest="command", required=True)
check = commands.add_parser("validate", help="Validate TM/TD structure")
@@ -78,7 +79,11 @@ def main():
report.add_argument(
"--model", help="Exact TM bytes the report claims; checks hash and fingerprints"
)
- args = parser.parse_args()
+ return parser
+
+
+def main():
+ args = get_parser().parse_args()
phase = "Input"
try:
if args.command == "new":
diff --git a/packages/modpoll-wot/profile.md b/packages/modpoll-wot/profile.md
index d05e5dd..b1f81b0 100644
--- a/packages/modpoll-wot/profile.md
+++ b/packages/modpoll-wot/profile.md
@@ -207,18 +207,18 @@ The model fingerprint is `mf1:` followed by the SHA-256 hex digest of the
sorted, deduplicated point fingerprints serialized as a JSON array without
whitespace. Aliases with identical mappings count once; write-only properties
do not contribute.
-[tests/fixtures/modsim.fingerprints.json](tests/fixtures/modsim.fingerprints.json)
+[tests/fixtures/modsim.fingerprints.json](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll-wot/tests/fixtures/modsim.fingerprints.json)
pins the canonical strings, point fingerprints and model fingerprint of the
37-property fixture for other implementations. Changing either canonical form
requires a new prefix.
-[tests/fixtures/conformance.fingerprints.json](tests/fixtures/conformance.fingerprints.json) does the same for
+[tests/fixtures/conformance.fingerprints.json](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll-wot/tests/fixtures/conformance.fingerprints.json) does the same for
`conformance.tm.json`, which covers every byte and word order and each Form extension; with
`conformance.data.json` it is also what the workspace integration tests serve with modsim and read with modpoll.
## Verification reports
A verification report records one reading of a Thing Model on a physical device. Its schema is
-[schemas/verification-report-5.json](modpoll_wot/schemas/verification-report-5.json)
+[schemas/verification-report-5.json](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll-wot/modpoll_wot/schemas/verification-report-5.json)
(JSON Schema 2020-12; schemas 3 and 4 remain valid). A report carries:
- Optional `product`: the catalog product ID `/`. The receiving
@@ -293,7 +293,7 @@ that a login made by any tool works for every tool on the same computer. It make
Simulation data describes the values a simulator serves for one device of a
Thing Model. Its schema is
-[schemas/simulation-data-1.json](modpoll_wot/schemas/simulation-data-1.json)
+[schemas/simulation-data-1.json](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll-wot/modpoll_wot/schemas/simulation-data-1.json)
(JSON Schema 2020-12), and Modsim loads it with `--data`.
| Field | Meaning |
diff --git a/packages/modpoll-wot/pyproject.toml b/packages/modpoll-wot/pyproject.toml
index b9e4a02..bf35201 100644
--- a/packages/modpoll-wot/pyproject.toml
+++ b/packages/modpoll-wot/pyproject.toml
@@ -14,7 +14,7 @@ dependencies = [
[project.urls]
Repository = "https://github.com/top-maker/modpoll"
-Documentation = "https://github.com/top-maker/modpoll/tree/v2/packages/modpoll-wot#readme"
+Documentation = "https://top-maker.github.io/modpoll/v2/"
[project.scripts]
modpoll-wot = "modpoll_wot.__main__:main"
diff --git a/packages/modpoll/vocab/wot-modbus/index.html b/packages/modpoll-wot/vocab/wot-modbus/index.html
similarity index 97%
rename from packages/modpoll/vocab/wot-modbus/index.html
rename to packages/modpoll-wot/vocab/wot-modbus/index.html
index 9a44437..a66a65c 100644
--- a/packages/modpoll/vocab/wot-modbus/index.html
+++ b/packages/modpoll-wot/vocab/wot-modbus/index.html
@@ -7,7 +7,7 @@
provides modv: entity, address, quantity and byte/word-order terms.
diff --git a/packages/modpoll/.github/scripts/assemble-docs.py b/packages/modpoll/.github/scripts/assemble-docs.py
deleted file mode 100644
index 47dab47..0000000
--- a/packages/modpoll/.github/scripts/assemble-docs.py
+++ /dev/null
@@ -1,76 +0,0 @@
-"""Update one documentation line in a complete Pages snapshot, preserving others."""
-
-import argparse
-from pathlib import Path
-import shutil
-
-RESERVED = {".git", ".nojekyll", "1.x", "v2", "vocab"}
-BANNER = ''
-
-
-def copy_contents(source, target):
- target.mkdir(parents=True, exist_ok=True)
- for entry in source.iterdir():
- dest = target / entry.name
- if entry.is_dir():
- shutil.copytree(entry, dest, dirs_exist_ok=True)
- else:
- shutil.copy2(entry, dest)
-
-
-def assemble(build, site, line, *, root=False, vocab=None):
- if line not in ("1.x", "v2") or not (build / "index.html").is_file():
- raise ValueError("invalid documentation line or missing build index")
- # Reject dangerous source/target overlap before deleting any generated files.
- if (
- build.resolve() == site.resolve()
- or site.resolve() in build.resolve().parents
- or build.resolve() in site.resolve().parents
- ):
- raise ValueError("build and snapshot must be separate trees")
- site.mkdir(parents=True, exist_ok=True)
- destination = site / line
- if destination.exists():
- shutil.rmtree(destination)
- copy_contents(build, destination)
- if root:
- for entry in site.iterdir():
- if entry.name not in RESERVED:
- if entry.is_dir():
- shutil.rmtree(entry)
- else:
- entry.unlink()
- copy_contents(build, site)
- if vocab:
- copy_contents(vocab, site / "vocab")
- for page in site.rglob("*.html"):
- if ".git" in page.parts:
- continue
- html = page.read_text()
- if 'id="modpoll-versions"' not in html:
- import re
-
- html = re.sub(
- r"(]*>)",
- lambda m: m[1] + BANNER,
- html,
- count=1,
- flags=re.IGNORECASE,
- )
- page.write_text(html)
- (site / ".nojekyll").touch()
-
-
-def main():
- parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument("build", type=Path)
- parser.add_argument("site", type=Path)
- parser.add_argument("line", choices=("1.x", "v2"))
- parser.add_argument("--root", action="store_true")
- parser.add_argument("--vocab", type=Path)
- args = parser.parse_args()
- assemble(args.build, args.site, args.line, root=args.root, vocab=args.vocab)
-
-
-if __name__ == "__main__":
- main()
diff --git a/packages/modpoll/.gitignore b/packages/modpoll/.gitignore
index 6a8e8f8..d52175a 100644
--- a/packages/modpoll/.gitignore
+++ b/packages/modpoll/.gitignore
@@ -243,7 +243,6 @@ $RECYCLE.BIN/
# Generated from CHANGELOG.md by make docs
/docs/changelog.rst
-/docs/site/changelog.rst
# Isolated WoT interoperability dependencies
node_modules/
diff --git a/packages/modpoll/Makefile b/packages/modpoll/Makefile
index b4d7775..fa38220 100644
--- a/packages/modpoll/Makefile
+++ b/packages/modpoll/Makefile
@@ -55,16 +55,6 @@ docker-run-dev: docker-build-dev ## Run docker compose for local dev
@echo "🚀 Docker compose run: ${PROJECT_NAME}:dev"
@docker compose up --build
-.PHONY: docs
-docs: ## Build docs into html files
- @uv run --group docs pandoc --from=markdown --to=rst CHANGELOG.md -o docs/site/changelog.rst
- @uv run --group docs sphinx-build docs/site/ docs/_build/html
-
-.PHONY: docs-serve
-docs-serve: ## Build and serve the docs for local dev
- @uv run --group docs pandoc --from=markdown --to=rst CHANGELOG.md -o docs/site/changelog.rst
- @uv run --group docs sphinx-autobuild docs/site/ docs/_build/html
-
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
diff --git a/packages/modpoll/README.md b/packages/modpoll/README.md
index 96cd7b7..1782b56 100644
--- a/packages/modpoll/README.md
+++ b/packages/modpoll/README.md
@@ -1,266 +1,24 @@
-> **2.x development branch.** This checkout accepts v1 CSV and WoT TM/TD JSON using profile 0.2; `--config` detects the format from the content. Install the current preview with `uv tool install --prerelease allow 'modpoll==2.0.0a13'`; stable 1.x remains available with `uv tool install 'modpoll<2'`. For development, run `make install`, then prefix project commands with `uv run`.
+# modpoll
-# Modpoll - A New Command-line Tool for Modbus and MQTT
-
-[](https://img.shields.io/github/v/release/top-maker/modpoll)
-[](https://github.com/top-maker/modpoll/actions/workflows/main.yml?query=branch%3Amain)
-[](https://img.shields.io/github/license/top-maker/modpoll)
+[](https://github.com/top-maker/modpoll/releases)
+[](https://github.com/top-maker/modpoll/blob/v2/packages/modpoll/LICENSE)
[](https://pepy.tech/project/modpoll)
-
-> Learn more about *modpoll* usage at [documentation](https://top-maker.github.io/modpoll) site.
-
-## Motivation
-
-The idea for creating this tool originated from my need to efficiently check new devices during site surveys. These surveys are often time-constrained and space-limited, with on-site work adding to the pressure. In such situations, a portable Swiss Army knife toolkit becomes a valuable companion.
-
-This tool can be easily deployed on a Raspberry Pi or similar embedded devices, polling data from a Modbus network or connected devices. Users can choose to log the data locally or publish it to an MQTT broker for further troubleshooting.
-
-The MQTT broker can be set up either on the same Raspberry Pi or in the cloud. Once data is successfully published, users can subscribe to the relevant MQTT topics and conveniently view the data on their smartphones.
-
-