Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/actions/linux-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ description: >-
cached: on a hit they are installed with dpkg, with no apt-get update and no mirror at all. The
key includes the runner image version, so the cached .deb files always match the base system.
On a miss apt runs with time limits and retries, and the packages it downloaded are saved.
inputs:
extra:
description: More packages for this job (e.g. the E2E's WebKitWebDriver, Xvfb, socat).
required: false
default: ""
runs:
using: composite
steps:
- id: key
shell: bash
env:
EXTRA: ${{ inputs.extra }}
run: |
packages="libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libudev-dev"
packages="libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libudev-dev $EXTRA"
echo "packages=$packages" >> "$GITHUB_OUTPUT"
echo "dir=$HOME/.cache/linux-deps" >> "$GITHUB_OUTPUT"
hash=$(printf '%s' "$packages" | sha256sum | cut -c1-16)
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
permissions:
contents: read

# A newer push to the same branch or pull request makes the older run moot.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

Expand Down Expand Up @@ -121,3 +126,74 @@ jobs:
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
if-no-files-found: error

# The real app against pymodbus (e2e/run.mjs), on both desktop platforms Tauri can drive.
# Windows has no socat, so its run has no serial checks and says so in its output.
e2e:
needs: [rust, frontend, file-size]
strategy:
fail-fast: false
matrix:
# Not windows-latest: on windows-2025 msedgedriver cannot attach to WebView2 even at matching
# versions ("DevToolsActivePort file doesn't exist", measured here with 156.0.4314.58 on
# 2026-11-06; https://github.com/actions/runner-images/issues/14738, closed upstream).
os: [ubuntu-24.04, windows-2022]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: .node-version
cache: npm
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- run: python -m pip install pymodbus==3.16.2
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
- uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2
with:
workspaces: src-tauri
shared-key: e2e
save-if: ${{ github.ref == 'refs/heads/master' }}
- name: System dependencies
if: runner.os == 'Linux'
uses: ./.github/actions/linux-deps
timeout-minutes: 30
with:
extra: webkit2gtk-driver xvfb socat
- run: cargo install tauri-driver --locked --version 2.1.0
# tauri-driver drives Edge WebView2 through msedgedriver, whose version must match the
# WebView2 on the runner (https://v2.tauri.app/develop/tests/webdriver/ci/).
- name: Edge driver matching WebView2
if: runner.os == 'Windows'
shell: pwsh
run: |
cargo install --git https://github.com/chippers/msedgedriver-tool
& "$HOME/.cargo/bin/msedgedriver-tool.exe"
$PWD.Path >> $env:GITHUB_PATH
# The driver must match WebView2, which can differ from Edge: print both to compare.
$webview = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" -ErrorAction SilentlyContinue
$edge = (Get-Item "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" -ErrorAction SilentlyContinue).VersionInfo.ProductVersion
Write-Output "WebView2 $($webview.pv), Edge $edge, $(& .\msedgedriver.exe --version)"
- run: npm ci
- run: npx tauri build --debug --no-bundle
- name: E2E (Linux)
if: runner.os == 'Linux'
run: xvfb-run -a node e2e/run.mjs
env:
E2E_OUT: ${{ runner.temp }}/e2e
- name: E2E (Windows)
if: runner.os == 'Windows'
run: node e2e/run.mjs
env:
E2E_OUT: ${{ runner.temp }}/e2e
# Failure screenshots and what the webview showed, to read a failure without guessing.
- if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: e2e-${{ runner.os }}
path: ${{ runner.temp }}/e2e
if-no-files-found: ignore
50 changes: 50 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Pages

# The project page at https://chetto1983.github.io/ModbusTool, built from site/ with the app's
# tokens and screenshots. Needs Settings → Pages → Source: GitHub Actions.
on:
push:
branches: [master]
paths:
- site/**
- docs/screenshots/**
- src/app.css
- src/assets/fonts/**
- src-tauri/icons/icon.svg
- scripts/build-site.mjs
- .github/workflows/pages.yml
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: .node-version
- run: node scripts/build-site.mjs
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
with:
path: _site

deploy:
needs: build
runs-on: ubuntu-24.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,24 @@ jobs:
assets/appimage/*.AppImage assets/appimage/*.AppImage.sig latest.json \
--repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \
--title "ModbusTool $TAG" --notes-file notes.md

# Updates the package in the Windows Package Manager (docs/publishing.md). It runs once the first
# version is in microsoft/winget-pkgs and the WINGET_TOKEN secret (a classic token with
# public_repo, from the account that forked winget-pkgs) is set; without the secret it skips.
winget:
needs: publish
runs-on: windows-latest
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
steps:
- name: Submit the new version to winget-pkgs
if: env.WINGET_TOKEN != ''
shell: pwsh
run: |
$version = "${env:TAG}".TrimStart("v")
$url = "https://github.com/${env:GITHUB_REPOSITORY}/releases/download/${env:TAG}/ModbusTool_${version}_x64_en-US.msi"
# A pinned release of Microsoft's tool, checked against its hash before it runs.
Invoke-WebRequest https://github.com/microsoft/winget-create/releases/download/v1.12.13.0/wingetcreate.exe -OutFile wingetcreate.exe
$hash = (Get-FileHash wingetcreate.exe -Algorithm SHA256).Hash
if ($hash -ne "24042BD37915805615E6CF969AC57C6439124C3FE85823327F5F3FB24BD9FFEA") { throw "wingetcreate.exe hash $hash" }
.\wingetcreate.exe update chetto1983.ModbusTool --urls $url --version $version --submit --token $env:WINGET_TOKEN
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ reports/
mutants.out*/
# Generated by Paraglide JS from messages/ (npm run i18n, or the Vite plugin).
src/paraglide/
_site/
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ Notable changes to ModbusTool, newest first. Each section is also the text of it
[GitHub release](https://github.com/chetto1983/ModbusTool/releases): the Release workflow
publishes the section whose heading matches the pushed `vX.Y.Z` tag. The full history is in git.

## v3.4.0 — 2026-11-06

A colour for every dashboard variable, from the theme or picked freely, and the end-to-end tests
now run on every change, on Linux and Windows.

### Added

- A colour for each dashboard variable: trend line, bar and lamp. Pick one of five theme colours
that follow the light and dark themes, or any custom colour with a colour picker
(color-picker-svelte). Without one, the automatic colours stay as before.

### Fixed

- Dashboards on Modbus TCP or UDP: a block of more than 123 neighbouring registers (3.3.1) was
refused by the master, so its values never updated. Blocks now stop at 123 registers on TCP/UDP
and at 125 on the other links, like the polls.

### Changed

- The end-to-end tests against an independent Modbus server run in CI on Linux and Windows. On
Windows they cover TCP, UDP and RTU over TCP; the serial checks need socat, which Windows lacks.

## v3.3.1 — 2026-11-06

Dashboards read neighbouring variables in one request, far less traffic on the device.
Expand Down
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# ModbusTool

A Modbus **master and slave** tool for Windows and Linux (macOS can be built from source).
Version 3 is a full rewrite of the WinForms tool as a [Tauri](https://tauri.app) desktop app:
Rust backend, Svelte frontend, one window for both roles.
A free, open-source Modbus **master and slave** for Windows and Linux, with live dashboards.
TCP, UDP, RTU, ASCII and RTU over TCP in one window, every common data type and byte order, a
frame-by-frame traffic monitor, and dashboards with trends, gauges, lamps and command panels.

![Master view](docs/screenshots/master-dark.png)
**[⬇ Download the latest release](https://github.com/chetto1983/ModbusTool/releases/latest)**:
Windows `.msi`, Linux `.deb` and `.AppImage` (see [Install](#install)). It updates itself.
Project page: <https://chetto1983.github.io/ModbusTool>.

![A dashboard reading a live slave: trend, gauge, lamp and bars](docs/screenshots/dashboard.gif)

## Features

**Links** — Modbus TCP, Modbus UDP, RTU over TCP, RTU serial, ASCII serial.
**Links**: Modbus TCP, Modbus UDP, RTU over TCP, RTU serial, ASCII serial.

**Master**
- Functions FC01–FC06, FC15, FC16.
Expand All @@ -23,6 +27,15 @@ Rust backend, Svelte frontend, one window for both roles.
- Value generators: sine, ramp, random, square wave.
- CSV import/export (also reads the ModbusTool 2 export format `4100:0x04c8,4101:12,...`).

**Dashboards**
- Several named dashboards per project, on a grid you arrange by dragging and resizing panels.
- Panels: trend (steps, straight or smooth lines, zoom), value with gauge and warning/alarm
colours, bars, lamp, button, switch, selector and number input.
- Every panel element reads its own variable (unit, table, address, type, byte order) while the
master is connected; neighbouring registers are read in one request.
- Scaling as SCADA tags do it (raw range to engineering range, both ways), and a colour per
variable from the theme or a colour picker.

**Both**
- Data types: UInt16, Int16, Hex, Binary, UInt32, Int32, Float32, UInt64, Int64, Float64, ASCII,
with byte orders ABCD, CDAB, BADC, DCBA. Labels per register.
Expand All @@ -31,9 +44,34 @@ Rust backend, Svelte frontend, one window for both roles.
- Projects saved as JSON (`Ctrl+S`, `Ctrl+O`). Dark and light theme, same design as Aura.
- Interface in English and Italian, chosen in the sidebar.

| Slave | Traffic monitor |
|---|---|
| ![Slave](docs/screenshots/slave-dark.png) | ![Traffic](docs/screenshots/traffic-dark.png) |
| Master | Slave | Traffic monitor |
|---|---|---|
| ![Master](docs/screenshots/master-dark.png) | ![Slave](docs/screenshots/slave-dark.png) | ![Traffic](docs/screenshots/traffic-dark.png) |

## How it compares

| | **ModbusTool** | Modbus Poll + Modbus Slave | ModbusTools (serhmarch) | QModMaster | mbpoll | Simply Modbus |
|---|---|---|---|---|---|---|
| Price | Free (MIT) | USD 129 each | Free (GPL-3.0) | Free (GPL/LGPL-3.0) | Free (GPL-3.0) | From USD 60 per tool |
| Windows / Linux / macOS | ✓ / ✓ / from source | ✓ / – / – | ✓ / ✓ / – | ✓ / ✓ / – | ✓ / ✓ / ✓ | ✓ / – / – |
| Interface | Desktop app | Desktop app | Desktop app | Desktop app | Command line | Desktop app |
| Master and slave | One app | Two products | Two apps | Master only | Master only | Separate products |
| TCP · UDP · RTU · ASCII · RTU over TCP | ✓ · ✓ · ✓ · ✓ · ✓ | ✓ · ✓ · ✓ · ✓ · ✓ | ✓ · ✓ · ✓ · ✓ · ✓ | ✓ · – · ✓ · – · – | ✓ · – · ✓ · – · – | ✓ · – · ✓ · ✓ · ✓ |
| 64-bit integers and doubles, 4 byte orders | ✓ | ✓ | ✓ | – | – (32-bit only) | – |
| Traffic monitor | ✓ | ✓ | ✓ | ✓ | – | Log file |
| Trend charts | ✓ | ✓ | – | – | – | – |
| Dashboards with commands | ✓ | – | – | – | – | – |
| Auto-update | ✓ | – | – | – | – | – |

– means not offered, or not stated by the project. Checked on 2026-11-06 against each project's
own site or repository: [Modbus Poll](https://www.modbustools.com/modbus_poll.html) and
[Modbus Slave](https://www.modbustools.com/modbus_slave.html)
([prices](https://www.modbustools.com/order.html)),
[ModbusTools](https://github.com/serhmarch/ModbusTools),
[QModMaster](https://sourceforge.net/projects/qmodmaster/),
[mbpoll](https://github.com/epsilonrt/mbpoll),
[Simply Modbus](https://www.simplymodbus.ca/tools.html) ([prices](https://www.simplymodbus.ca/purchase.html)).
Corrections are welcome as issues.

## Install

Expand Down Expand Up @@ -111,7 +149,9 @@ cd src-tauri && cargo fmt --check && cargo clippy --all-targets -- -D warnings &
```

End-to-end run of the real app against [pymodbus](https://github.com/pymodbus-dev/pymodbus) as an
independent implementation (Linux; needs `tauri-driver`, `WebKitWebDriver`, `socat`, `pymodbus`):
independent implementation. CI runs it on Linux and Windows (Windows without the serial checks,
which need `socat`). Locally on Linux it needs `tauri-driver`, `WebKitWebDriver`, `socat` and
`pymodbus`:

```sh
npx tauri build --debug --no-bundle
Expand Down
78 changes: 78 additions & 0 deletions docs/publishing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Publishing to winget and Flathub

Both stores take a package through a pull request from the maintainer's GitHub account to a
repository they own (`microsoft/winget-pkgs`, `flathub/flathub`). This repository holds what those
pull requests need; opening them is the maintainer's step.

## winget (Windows Package Manager)

Package identifier: `chetto1983.ModbusTool`. Installer: the release's MSI
(`ModbusTool_<version>_x64_en-US.msi`, publisher `chetto1983` from 3.4.0).

**First submission, by hand on Windows** (winget-pkgs reviews the first version of a package):

```powershell
winget install Microsoft.WingetCreate
wingetcreate new https://github.com/chetto1983/ModbusTool/releases/download/v3.4.0/ModbusTool_3.4.0_x64_en-US.msi
```

`wingetcreate new` reads the MSI (product code, version, publisher) and asks for the rest. Give:

- Package identifier `chetto1983.ModbusTool`
- License `MIT`, license URL `https://github.com/chetto1983/ModbusTool/blob/master/LICENSE`
- Short description `Modbus master and slave with live dashboards`

At the end, answer yes to submitting. It forks `winget-pkgs` under your account and opens the pull
request. A bot validates it and runs the installer in a sandbox. Unsigned MSIs are accepted, but
SmartScreen still warns when the installer runs.

**Later versions, automatic**: the `winget` job of the Release workflow submits each new version
with `wingetcreate update`. It needs a repository secret `WINGET_TOKEN`: a classic personal access
token with the `public_repo` scope, from the account that holds the `winget-pkgs` fork. Without
the secret the job does nothing. The job downloads a pinned `wingetcreate` and checks its SHA-256
before running it.

## Flathub

App id: `io.github.chetto1983.modbustool`, the same as `identifier` in `tauri.conf.json`. Flathub
verifies an `io.github.<user>` id against the GitHub account of the same name.

Files in `packaging/flatpak/`:

| File | Checked |
|---|---|
| `io.github.chetto1983.modbustool.metainfo.xml` | `appstreamcli validate --no-net`: passes |
| `io.github.chetto1983.modbustool.desktop` | `desktop-file-validate`: passes |
| `io.github.chetto1983.modbustool.yml` | **Not built yet.** It follows the open-source path of the [Tauri Flathub guide](https://v2.tauri.app/distribute/flatpak/); `flatpak-builder` was not available where it was written |

**Before submitting**:

1. **Turn off the self-updater inside Flatpak.** Flathub updates the app. The in-app updater would
download the AppImage from the GitHub release instead, so it has to be disabled when the app
runs in a Flatpak (the `FLATPAK_ID` environment variable is set there). This is a code change
and is not done yet.
2. **Pick the GNOME runtime.** The manifest uses `47`, the Tauri guide's version. Use a runtime
Flathub still supports that ships `webkit2gtk-4.1`, and update `runtime-version`.
3. **Generate the offline sources.** The Flatpak build has no network. Generate them with
[flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools) at the tag being
published:

```sh
python3 flatpak-builder-tools/cargo/flatpak-cargo-generator.py src-tauri/Cargo.lock -o cargo-sources.json
flatpak-node-generator npm package-lock.json -o node-sources.json
```

4. **Build and run it locally**, then fix what fails:

```sh
flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo build \
packaging/flatpak/io.github.chetto1983.modbustool.yml
flatpak-builder --run build packaging/flatpak/io.github.chetto1983.modbustool.yml modbus-tool
```

Check that TCP, UDP and a USB serial adapter all work from inside the sandbox.

**Submitting** (from the [Tauri guide](https://v2.tauri.app/distribute/flatpak/)): fork
`flathub/flathub`, clone the `new-pr` branch, add the manifest and the two generated JSON files on
a branch named after the app, and open a pull request against `new-pr`. After the review, Flathub
gives you a repository for the app, where later versions are updated.
Binary file added docs/screenshots/dashboard.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/superpowers/plans/2026-11-06-dashboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ lo storico non cresce senza limite; gridstack e Svelte non si contendono il DOM.
- [x] **T11 Blocchi di lettura**: blocchi di variabili contigue per unit, tabella e periodo; un poll del
backend per blocco; valori e storico di ogni variabile presi dal suo blocco; test (blocchi,
limiti 125/2000, nessun buco letto); misura delle richieste prima e dopo contro pymodbus.

## Colore delle variabili (spec D22)

- [x] **T12 Colore**: `colour` sulla variabile (validazione, conversione dei file senza), colori
fissi dai token e personalizzato con color-picker-svelte; trend, barre e lampada; test; E2E
(lampada accesa nel colore scelto).
Loading
Loading