Skip to main content

TagScope

Log OPC UA tags to a database and watch them live in your browser.

A lightweight historian for PLCs and industrial equipment: subscribe to any OPC UA server (Siemens S7-1500, Beckhoff, B&R, Kepware, Ignition, Prosys…), store every change in SQLite or PostgreSQL, and get a fast, modern dashboard with live values, trends, alarms and CSV export. One pip install, one YAML file, no cloud.

CI PyPI Python License: MIT

TagScope dashboard showing live tag cards, a multi-tag trend and the OPC UA address space browser

Try it in 10 seconds

pip install tagscope
tagscope demo

demo starts a small simulated plant (a buffer tank, a transfer pump that trips now and then, a reactor and a filler) as an OPC UA server, logs it to tagscope-demo.db and opens the dashboard at http://localhost:8000. It even pre-fills 30 minutes of history, so the trends look alive from the first second.

Why

Getting PLC data into a database usually means a commercial historian, a Node-RED flow you have to babysit, or a one-off script without a UI. TagScope sits in between:

  • Small: a single Python process, no broker, no separate front-end build.
  • Honest storage: plain SQL tables you can query from Grafana, Power BI, Excel or pandas.
  • Made for the plant floor: limits and alarms, deadbands, reconnects that just work, and a dashboard that follows ISA-101 ideas (calm grey, colour only when something is wrong).

Features

Collect OPC UA subscriptions (not polling) for many servers at once, username/password login, automatic reconnect with back-off, per-tag deadband
Store SQLite out of the box, PostgreSQL / TimescaleDB via tagscope[postgres], retention clean-up, quality flag per sample
See Live value cards with sparklines and limit bars, multi-tag trends with zoom (5 min to 24 h, downsampled server side), event log, dark and light themes, works on a phone
Alarm High / low limits per tag, alarm and clear events with timestamps, active alarm counter
Explore Built-in address space browser: click through the server and copy node ids into your config
Export One click CSV from the dashboard, tagscope export from the shell, REST API with OpenAPI docs at /api/docs, WebSocket feed at /ws

Use it with your PLC

tagscope init                                   # writes an example tagscope.yaml
tagscope browse opc.tcp://192.168.0.1:4840      # find the node ids you need
tagscope run tagscope.yaml --open
storage: sqlite:///line1.db          # or postgresql+psycopg://user:${DB_PASSWORD}@host/db
retention_days: 90

servers:
  - name: line1-plc
    endpoint: opc.tcp://192.168.0.1:4840
    username: ${PLC_USER:-}            # values can come from the environment
    password: ${PLC_PASSWORD:-}
    publishing_interval_ms: 500
    tags:
      - name: Mixer/Temperature
        node: ns=3;s="DB_Mixer"."Temperature"
        unit: °C
        low: 20
        high: 85
        deadband: 0.1                  # store only changes bigger than this
      - name: Mixer/Running
        node: ns=3;s="DB_Mixer"."Running"
      - ns=3;s="DB_Counters"."Good"   # short form: the node id is the name

More in examples/, including a Siemens S7-1500 setup and PostgreSQL.

Siemens tip: enable the OPC UA server in the PLC properties in TIA Portal and tick Accessible from HMI/OPC UA on the data blocks you want to log. Node ids then look like ns=3;s="DB_Name"."Member".

Command line

Command What it does
tagscope demo Simulated plant + logger + dashboard, nothing to configure
tagscope run CONFIG Log the servers and tags in a YAML file and serve the dashboard
tagscope init [PATH] Write an example config
tagscope browse ENDPOINT [NODE] List the nodes of a server, with current values
tagscope export CONFIG --minutes 60 -o out.csv Export logged samples

Data model

Three tables, easy to query from anything that speaks SQL:

SELECT t.name, s.ts, s.value
FROM tagscope_samples s JOIN tagscope_tags t ON t.id = s.tag_id
WHERE t.name = 'Mixer/Temperature' AND s.ts > CAST(strftime('%s', 'now', '-1 hour') AS REAL);
Table Columns
tagscope_tags id, name, server, node, unit, description, low, high
tagscope_samples tag_id, ts (epoch seconds), value, quality (0 good, 1 uncertain, 2 bad)
tagscope_events id, ts, tag, kind (alarm, cleared, info, warning, error), message

How it works

flowchart LR
    PLC1[PLC / OPC UA server] -- subscriptions --> C[Collector]
    PLC2[More servers] -- subscriptions --> C
    C --> H[(Live state + alarms)]
    H -- batched writes --> DB[(SQLite / PostgreSQL)]
    H -- WebSocket --> UI[Dashboard]
    DB -- history, CSV --> API[REST API] --> UI

Everything runs on one asyncio event loop: asyncua subscriptions feed an in-memory hub, which applies deadbands and limits, pushes updates to browsers over a WebSocket and hands batches to a writer that flushes to the database once a second.

Docker

docker build -t tagscope .
docker run -p 8000:8000 tagscope demo --host 0.0.0.0 --no-browser
docker run -p 8000:8000 -v $PWD:/data tagscope          # uses ./tagscope.yaml

Development

git clone https://github.com/DanShinde/tagscope && cd tagscope
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest            # includes end-to-end tests against the simulated OPC UA server
ruff check . && ruff format --check .

The dashboard is plain HTML, CSS and JavaScript in src/tagscope/static, no build step. Charts use uPlot (MIT), bundled for offline use.

Roadmap

  • Write values back to the PLC from the dashboard (opt-in, with confirmation)
  • Add tags from the address space browser without editing YAML
  • Modbus TCP and Siemens S7 (snap7) sources
  • MQTT / Sparkplug B output
  • Desktop build (single executable for Windows engineering laptops)

Ideas and pull requests are welcome, see the issues.

License

MIT © Dan Shinde

Metadata

Release files for tagscope 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tagscope 0.1.0
File Size Uploaded Provenance Actions
tagscope-0.1.0.tar.gz 61.1 kB With provenance Details for tagscope-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tagscope 0.1.0
File Interpreter ABI Platform Actions
tagscope-0.1.0-py3-none-any.whl Python 3 none any Details for tagscope-0.1.0-py3-none-any.whl

Total release size: 121.8 kB

Release files / tagscope-0.1.0.tar.gz

Download URL tagscope-0.1.0.tar.gz
Size 61.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1baf1450319c0c7f2501433e0fdab563f4cf0b766c6537c29dae31b852c0144b
BLAKE2b-256 checksum
How to use checksums
ce9619d9c57d4caa42e0bd4b1639685ccbfc22e7ef13b03d662bf9c51504a8c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / tagscope-0.1.0-py3-none-any.whl

Download URL tagscope-0.1.0-py3-none-any.whl
Size 60.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a472848566aa7d1710fcf9577e65882aafa3b27dc2d6557c5d3942d4af9945
BLAKE2b-256 checksum
How to use checksums
645cd5c63d66ebb62a17fa842fcd2b4132fda74de53190eed70f831982cfdb2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for tagscope 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tagscope-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page