Skip to main content

Human-friendly dashboard for mtr2mqtt summary topics

Project description

mtrview

mtrview

CI Docker Trivy PyPI version Python 3.11-3.13 License: MIT

mtrview is a small standalone web dashboard for retained JSON summaries published by mtr2mqtt. mtr2mqtt writes the measurement summaries to MQTT; mtrview subscribes to those topics and turns the latest values into a simple human-friendly dashboard.

The app subscribes to summary topics such as summary/<receiver>, keeps the latest summary per receiver in memory, normalizes transmitter readings, and serves a dark auto-updating dashboard at http://localhost:8000/.

MQTT input

By default mtrview subscribes to:

summary/#

Each retained message should be a JSON object with a receiver, an updated_at timestamp, and a transmitters mapping. Transmitter metadata may be partial; missing location, zone, quantity, description, unit, or battery fields are displayed with sensible placeholders instead of failing.

Configuration

Settings are read from environment variables:

Variable Default
MTRVIEW_MQTT_HOST localhost
MTRVIEW_MQTT_PORT 1883
MTRVIEW_MQTT_USERNAME unset
MTRVIEW_MQTT_PASSWORD unset
MTRVIEW_MQTT_TOPICS summary/#
MTRVIEW_HTTP_HOST 0.0.0.0
MTRVIEW_HTTP_PORT 8000
MTRVIEW_REFRESH_INTERVAL_SECONDS 20
MTRVIEW_DISPLAY_TIMEZONE UTC

See .env.example for a copyable starting point.

Local run

uv sync --group dev
uv run mtrview

Then open http://localhost:8000/.

Useful endpoints:

  • GET / - dashboard
  • GET /api/summary - normalized JSON for all receivers and transmitters
  • GET /health - health status

Docker

docker build -t mtrview .
docker run --rm -p 8000:8000 \
  -e MTRVIEW_MQTT_HOST=host.docker.internal \
  -e MTRVIEW_MQTT_TOPICS=summary/# \
  mtrview

Published Docker images support linux/amd64, linux/arm64, linux/arm/v7, and linux/arm/v6 for Pi Zero-class 32-bit ARM devices. The image intentionally uses Uvicorn without optional native performance extras so old Raspberry Pi targets can install dependencies without a compiler and the runtime image stays small.

Dashboard

The UI is server-rendered first, with a small vanilla JavaScript refresh loop that fetches /api/summary. It includes summary counts, MQTT connection state, search, status/zone/receiver filters, card and compact table views, and a priority section for non-online readings. Transmitter battery state is shown in the card, table, and detail views when present. Battery labels are derived from voltage: full at 3.1 V or higher, good at 2.9-3.0 V, medium at 2.7-2.8 V, low at 2.6 V, and critical at 2.5 V or lower.

Development

make install
make verify

Individual checks:

uv run pytest
uv run ruff check .

Releases

Releases are managed by GitHub Actions using Conventional Commits and semantic-release. Merges to master can create GitHub releases, publish the Python package to PyPI, and publish multi-arch Docker images to Docker Hub as tvallas/mtrview.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mtrview-0.3.3.tar.gz (321.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mtrview-0.3.3-py3-none-any.whl (272.0 kB view details)

Uploaded Python 3

File details

Details for the file mtrview-0.3.3.tar.gz.

File metadata

  • Download URL: mtrview-0.3.3.tar.gz
  • Upload date:
  • Size: 321.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mtrview-0.3.3.tar.gz
Algorithm Hash digest
SHA256 8376f362b62223ba20aced234f89add687c48233f529d0478b81a233250b4ace
MD5 1e2795106456ba271920e0ef7f34a413
BLAKE2b-256 4ff1ca47aa51e0225dae1126d2dbbc2c94f3afe21ea21a8686b5a3da03b882d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtrview-0.3.3.tar.gz:

Publisher: semantic_release.yml on tvallas/mtrview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mtrview-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: mtrview-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 272.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mtrview-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 594559612a86ac2714f84911bac8943cab9a30bc82e0d99e3ca857a4028226c5
MD5 aaa9c90ef25d7f7bc971b5e8c5ba03dc
BLAKE2b-256 ec85c0cbe831e010ba6fcffe5e49f9e74b2b6b6aac31965bd9551fba91604353

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtrview-0.3.3-py3-none-any.whl:

Publisher: semantic_release.yml on tvallas/mtrview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page