History
WiConnector can store every value change of chosen tags in a PostgreSQL database. When the server also has the TimescaleDB extension, WiConnector uses it automatically: the table becomes a hypertable split into one-day chunks, which keeps queries fast and makes deleting old data cheap. Without TimescaleDB, a plain PostgreSQL table is used and everything still works.

History is off until you turn it on. There are two kinds of database:
- Built-in: the TimescaleDB database installed with WiConnector (Docker Compose). Nobody but WiConnector can log in to it. See Built-in database.
- Another PC: PostgreSQL / TimescaleDB on another computer, prepared with a setup kit from WiConnector and then locked down like the built-in one. See Database on another PC.
- External: a PostgreSQL / TimescaleDB server you run yourself, entered by host, port and credentials.
History can use one database (Standalone) or a primary and a backup (Redundant). See Redundant history.
Turn history on
- Open the History tab.
- Pick Built-in to use the database installed with WiConnector (no other fields needed), or External and
enter the host, TCP port (5432 by default), database name, username and password. The database
must already exist and the user must be able to create a table in it (and a schema, if you choose one other than
public). - Click Test connection. It shows the PostgreSQL version and whether TimescaleDB was found. If it fails, the message says why: a wrong password, a refused connection, or an unknown database.
- Switch Database on and click Save and apply. WiConnector creates the table
tag_historyand starts writing. The badge at the top shows Writing to TimescaleDB (or PostgreSQL). - In Tag Management, open a tag and switch on its History section. For tags made from a template, switch it on for the template's tag, so every bound group gets it.
History settings of a tag
Each tag (and each template tag) has a History section:
| Setting | Meaning |
|---|---|
| Deadband (mode, value) | Store a change only when it differs from the last stored value by more than this (absolute, or percent of the EU range). On top of the tag's own deadband. 0 stores every change. Not shown for Bool tags. |
| Rate minimum (ms) | At most one stored value per this time. Changes that come sooner are held, and the latest one is stored when the time is up. 0: no limit. |
| Rate maximum (ms) | Store the current value again when nothing was stored for this long, e.g. 60000 for once a minute, so a flat line still shows in trends. At least 1000. 0: only on change. |
| Range Y minimum / maximum | Y axis of the tag's trend. Empty: automatic. |
| Interpolation | Linear draws straight lines between values (analog); Step holds each value until the next (states, setpoints). |
| Default method | How a trend combines values when zoomed out: average, minimum, maximum, first or last. |
A change of quality (Good to Bad and back) is always stored, whatever the deadband and rates. The chart settings are used by trends, which come in a later version.
The password and the TLS key passphrase are stored encrypted in data/history/history.json. The key used to
encrypt them is data/history/secret.key. Keep both together in backups; without the key the password has to be
entered again.
What is stored
Each value change that passes the tag's deadband is one row:
| Column | Contents |
|---|---|
time | When the value was read (UTC) |
tag | Tag path, e.g. Plant/Line1/Pump1/Speed |
value | Number (Bool is stored as 1 or 0) |
value_text | Text, for String tags |
quality | 0 Good, 1 Uncertain, 2 Bad |
Changes are collected and written once a second, in one batch. When history starts, the current value of every history tag is written too, so every trend has a starting point.
Renaming tags and groups
History is stored under the tag's path. When you rename or move a tag or a group, its stored history moves to the new name, so trends continue without a break. If the database cannot be reached at that moment (or WiConnector restarts), the rename is kept and applied as soon as the database is back; values still in the store-and-forward buffer under the old name are written first and moved too. Renaming a tag in a template renames it in every group bound to the template, and their history moves the same way.
TLS
TLS is part of each database's own settings (for an External server): switch on TLS at the bottom of the Database section, or of the Backup database section for the backup, to encrypt that connection.
- Reject servers whose certificate cannot be verified (recommended): the server's certificate must be signed by a trusted authority (or the CA certificate you give) and match the host name.
- With it off, the connection is encrypted but the certificate is not checked. Use this only on a network you trust.
- Client certificate and Private key are only needed when the server asks clients for a certificate.
Click Browse… next to a certificate or key to pick the file on your own computer: it is uploaded to WiConnector
(data/certificates) and its path is filled in. You can also type a path on the WiConnector computer; files
uploaded earlier are suggested as you type. Uploaded files are readable only by the WiConnector service account.
Store and forward
When the database cannot be reached, values are not lost. They are written to a buffer on disk and sent, oldest first, as soon as the database is back. The badge shows Database unreachable, buffering, and Buffered shows how many values are waiting. WiConnector retries the connection every few seconds, up to once a minute.
| Setting | Meaning |
|---|---|
| Storage path | Folder for the buffer. Empty uses data/history/buffer. |
| Memory queue | Values waiting for the next one-second write. If more arrive than fit, the oldest are dropped (shown in Dropped). |
| Disk buffer size | Largest size of the buffer on disk. About 40 bytes per value: 2048 MB holds roughly 50 million values. |
| When the buffer is full | Drop the oldest values keeps recent data; Drop new values keeps the oldest data. |
| Drop buffered values older than | Optional: gives up on values that are too old to be useful. |
Values still waiting when WiConnector stops are kept on disk and sent after the next start.
Values that were never read, because the device was unreachable or WiConnector was stopped, cannot be buffered. For OPC UA servers that keep their own history, WiConnector reads such gaps back after reconnecting: see Filling history gaps from the server.
Data retention
Switch on Data retention and set a Retention period to delete history older than that many days. The check runs every hour. With TimescaleDB whole days are dropped at once; on plain PostgreSQL old rows are deleted.
Built-in database
With docker compose up, a timescaledb service runs next to WiConnector. It is locked down so that only
WiConnector can read or change the history:
- On the first start WiConnector writes a random one-time password to a shared secrets volume. The database starts with it.
- WiConnector logs in once with that password, creates its own login
wiconnectorwith a random 32-byte password and the databasewiconnectorowned by it, and turns on TimescaleDB. - It then changes the database superuser's password to a random value that is not saved anywhere, and deletes the one-time password file.
- WiConnector's own password is stored encrypted in
data/history/history.jsonand is never shown in the UI or sent by the API. - The database has no port published on the host. It is reachable only on a private Docker network that only WiConnector joins, so no other program or computer can connect to it. Traffic on that network is not TLS encrypted, because it never leaves the host.
If the stored password stops working while the one-time file still exists (for example after the database volume was recreated), WiConnector sets the database up again by itself.
The limit. Someone with full administrator (root) rights on the host can still open a shell in the database container and use its local socket, or copy the volume files. No database can prevent that. Protect against it by limiting who is administrator on the host, and protect stolen disks with disk encryption (below).
A Windows installer with the database as a local Windows service (listening on 127.0.0.1 only) is planned. It will
use the same set-up, configured in appsettings.json under WiConnector:History:BuiltIn.
Database on another PC
Choose Another PC as the database type when the history should live on a different computer from the WiConnector server. The History page then shows two steps.

Step 1: prepare the database PC.
- Install PostgreSQL 16 on the database PC, and TimescaleDB if you can. Alternatively, install Docker.
- In WiConnector, check This server's address: the address of the WiConnector server as the database PC sees it. It is filled in with this server's address. Only this address will be allowed to connect.
- Click Download setup kit and copy the zip to the database PC. The kit holds:
- a TLS certificate and key made just for this database;
windows/setup-database-pc.ps1, for PostgreSQL installed as a Windows program;docker/docker-compose.yml, for Docker;README.txt, with the steps.
- Run one of them on the database PC, as
README.txtdescribes.- The Windows script turns on TLS with the kit's certificate, allows connections only from the WiConnector server, opens the port in Windows Firewall for that address only, adds TimescaleDB to the preloaded libraries when it is installed, and restarts PostgreSQL.
- The Docker file does the same inside the container.
Step 2: connect and lock down.
- Enter the database PC's address and port.
- Enter the admin user (usually
postgres) and its password. This is the password chosen when PostgreSQL was installed, orADMIN_PASSWORDin the kit'sdocker/.env. It is used once and not stored. - Leave Lock the admin account on, then click Set up and connect. WiConnector then:
- creates its own login
wiconnectorwith a random password, stored encrypted; - creates the database
wiconnectorand turns on TimescaleDB if it is there; - replaces the admin password with a random one that is not kept;
- switches history to the new database.
- creates its own login
From then on WiConnector connects only over TLS, and only to a server that shows the kit's certificate. The certificate is checked even if the database PC's address changes. If the address changes, type the new one under Database PC address and save.
If step 2 fails, the message says why:
| Message says | What to do |
|---|---|
| The admin password is wrong | Check the admin password. |
| This server is not allowed | Make a new kit with the right server address and run it again. |
| The certificate is not the newest kit's | Run the newest kit's script on the database PC. |
| No answer / connection refused | Check the address, that the script ran, and the firewall. |
Each new kit has a new certificate, so always run the newest one. Delete the kit from the database PC after setup, because it contains the TLS key.
With Lock the admin account on, nobody has a password to the database except WiConnector. If you need admin access
later, for example to upgrade PostgreSQL, a Windows administrator on the database PC can reset the postgres
password. As with the built-in database, an administrator of that PC can always reach the data, so protect it and
turn on disk encryption.
Redundant history (primary and backup database)

The Redundancy section on the History page chooses between:
- Standalone: one history database (the default, and how WiConnector worked before).
- Redundant: a primary and a backup database. The page then shows a Primary database and a Backup database section, each with its own type (Built-in, Another PC or External), connection, TLS and Test connection button.
Set up a redundant historian
- Set up the primary database as usual (see Turn history on).
- Open Redundancy and set Type to Redundant.
- Choose a Write mode (see below).
- In Backup database, pick its type and enter its connection. For Another PC, use the two setup steps in that section; WiConnector sets up the other PC as the backup.
- Click Test backup connection, then Save and apply.
The primary and the backup cannot be the same database, and only one of them can be the built-in database.
Write modes
Mirror (write to both) (default)
- Every value goes to both databases, so each has the full history.
- Each database has its own disk buffer. One that is down catches up when it is back, while the other keeps receiving values.
- The backup's buffer is the
backupfolder inside the store-and-forward storage path, so it needs disk space too.
Failover
- WiConnector writes every value to the primary.
- When the primary cannot be reached, values go to the backup straight away. The badge at the top shows Primary down, writing to the backup.
- With Copy back on (default), the same values also wait in the disk buffer for the primary. When the primary answers again, WiConnector writes to it again and sends it what it missed, so the primary has no gap.
- If both databases are down, values wait in the disk buffer (see Store and forward).
What you see
Two cards under the counters show each database: Connected, Standby (failover backup that is ready), Unreachable (with the reason) or Connecting, and its written values, buffered values, last write and size. The database in use has an orange In use label. In System Configuration > Modules, the historian stays Running while either database is in use.
WiConnector checks a database with nothing to write every 10 seconds, so a failure is noticed even when no values change. A database that fails is retried every few seconds, up to once a minute.
Reading, retention and backups
- Trends, OPC UA HistoryRead and Encrypted backup read from the primary, or from the backup while the primary is down.
- Restore adds the values to every database that can be reached, so both keep the same history.
- Data retention and Disk space apply to each database. The size limit is checked per database.
- Renamed tags are renamed in both databases (in one that is down, as soon as it is back).
Encrypted backup and restore
The Backup section of the History page saves history to an encrypted file (.wchb) and loads it back:
- Enter a passphrase of at least 12 characters, and optionally a time range: click From or To to open the calendar, pick a day and the hour and minute (Now fills in the current time, the × clears it). Click Download backup.
- Keep the passphrase safe and apart from the file. Without it the backup cannot be read, also not by Altrex.
- To restore, click Choose… (or drop the
.wchbfile on the field), enter the same passphrase and click Restore. Rows that are already in the database are skipped, so restoring the same file twice adds nothing.
The file is compressed and encrypted with AES-256-GCM, with a key derived from the passphrase (PBKDF2-SHA256, 600,000 rounds). A wrong passphrase, a damaged or changed file, or a file that was cut short is refused with a message saying which, and nothing is written.
Disk encryption
The database files on disk are not encrypted by the database itself. To protect them if a disk or computer is stolen, encrypt the disk that holds the Docker volumes (or the PostgreSQL data folder):
- Windows: turn on BitLocker for the drive (Settings > Privacy & security > Device encryption, or Control Panel > BitLocker Drive Encryption). Keep the recovery key somewhere else.
- Linux: install on a LUKS-encrypted partition (offered by most installers), or put
/var/lib/dockeron one. - Cloud VMs: turn on the provider's disk encryption.
This also covers WiConnector's data folder, which holds the key that encrypts the stored passwords.
Disk space
The Disk space section keeps history from filling the disk. This matters most when retention is set to keep history forever. It is on by default and checks every 10 minutes.
- Warn when free space is below (%): when the disk that holds WiConnector's data has less free space than this
(10 % by default), the History page shows a red warning and the log says so. When the database runs on this
computer (Built-in, or a host of
localhost), this is also the database's disk. - Maximum history size (GB): optional. History bigger than this also counts as "too big". The size is measured in the database, so this works for a database on another PC or an external server too.
- Delete the oldest day of history: off by default. When it is on and space is low (database on this computer) or history is over its size, WiConnector deletes the oldest day of history. It then checks again and repeats, up to 30 days per check. The last day is never deleted. Each deletion is logged and shown on the History page.
Deleting needs TimescaleDB, because dropping a day gives the disk space back at once. The built-in database has TimescaleDB. On plain PostgreSQL, deleted rows do not free disk space, so WiConnector only warns there.
With retention on, old days are already deleted on schedule; this setting is the safety net for when the disk fills up earlier than planned.
Reading history
Until trends are added to the UI, values can be read with:
GET /api/history/values?tag=Plant/Line1/Pump1/Speed&from=2026-11-25T00:00:00Z&to=2026-11-25T12:00:00Z
from defaults to one hour before to, and to defaults to now. At most 10,000 values are returned (limit
raises this to 100,000). With an External database, any PostgreSQL tool, such as Grafana or Power BI, can also read
the tag_history table directly. The Built-in and Another PC databases cannot be reached by other tools, by design.