Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# OSPy-plugins Changelog

October 13 2026
----------------
(Martin Pihrt) - Database Connector v1.1.3<br/>
Moved the successful settings `SeeOther` redirect outside the POST exception handler, so its normal HTTP 303 response is not reported as an internal error. Added a regression test for the real settings POST flow.

October 13 2026
----------------
(Martin Pihrt) - Database Connector v1.1.2<br/>
Fixed saving Database Connector settings after a database backup existed. Runtime backup names, backup sizes and queue counters are now excluded from OSPy's generic option-form parser, which incorrectly treats every list as a list of integers; existing `.sql` backup files and saved options require no migration.

October 13 2026
----------------
(Martin Pihrt) - Database Connector v1.1.1<br/>
The durable database queue now restores the original command timestamp for MySQL/MariaDB `CURRENT_TIMESTAMP` and timestamp-default writes, so all plug-ins using Database Connector keep measurement time after an outage. Added configurable 80 MiB warning and 100 MiB maximum queue sizes, one-time SSL e-mail alerts with an editable subject, SD-card protection by rejecting new commands past the maximum, queue size diagnostics and regression coverage.

October 11 2026
---------------
(Martin Pihrt) - Repository documentation<br/>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ This table is generated from the `name`, `version` and `description` fields in e
| [**CHMI**](plugins/chmi/) | `1.0.7` | Downloads CHMI or SHMU radar data, detects local rain and optionally controls a hardware map. |
| [**CLI Control**](plugins/cli_control/) | `1.0.0` | Runs administrator-configured shell commands when OSPy station states change. |
| [**Current Loop Tanks Monitor**](plugins/current_loop_tanks_monitor/) | `1.1.1` | Monitors up to four water tanks through an ADS1115 and 4-20 mA pressure sensors. |
| [**Database Connector**](plugins/database_connector/) | `1.1.0` | Provides a shared MySQL connection and backup interface for OSPy plug-ins. |
| [**Database Connector**](plugins/database_connector/) | `1.1.3` | Provides shared MySQL access, backup and durable queued writes for OSPy plug-ins. |
| [**Direct 16 Relay Outputs**](plugins/relay_16/) | `1.0.0` | Controls up to 16 direct Raspberry Pi GPIO relay outputs with configurable trigger polarity. |
| [**Door Opening**](plugins/door_opening/) | `1.0.0` | Activates a selected OSPy station for a bounded door or gate opening interval. |
| [**E-mail Notifications**](plugins/email_notifications/) | `1.0.1` | Sends OSPy event notifications through a STARTTLS SMTP server with an optional retry queue. |
Expand Down
16 changes: 9 additions & 7 deletions plugins/database_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ Tested in Python 3+
This extension uses a database connection via the interface: mysql-connector-python to install use: sudo pip install mysql-connector-python.
https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html

The plug-in includes an OSPy `plugin.json` manifest and implements the common
lifecycle and `health()` interfaces. Diagnostics reports whether the connector
is enabled and available, its version, configured server and database, and the
result of the latest real database operation. Database connections and cursors
are closed after every operation.
The plug-in includes an OSPy `plugin.json` manifest and implements the common lifecycle and `health()` interfaces. Diagnostics reports whether the connector is enabled and available, its version, configured server and database, and the result of the latest real database operation. Database connections and cursors are closed after every operation.

October 10, 2026 GitHub/OSPy-plugins/plugins/database_connector — Added an optional durable SQLite-backed database command queue. When Use buffer is enabled, SQL commands from other plug-ins are saved locally in order and replayed in the background; commands remain queued during database outages and survive OSPy restarts. The settings page shows the queued command count and provides a CSRF-protected Clear queue action. Disabling the buffer stops queue replay and new commands use the direct database path.
October 13, 2026 GitHub/OSPy-plugins/plugins/database_connector — The durable SQLite-backed queue now preserves the source-command timestamp when it replays a statement. For MySQL/MariaDB statements that use `CURRENT_TIMESTAMP` or a `TIMESTAMP DEFAULT CURRENT_TIMESTAMP` column, the restored record therefore retains the original logging time instead of the later recovery time. The queue has an adjustable warning threshold (80 MiB by default), a hard maximum (100 MiB by default), an optional alert through E-mail Notifications SSL and an editable alert subject. Version 1.1.2 excludes runtime backup-file lists and queue counters from the generic settings parser, so existing `.sql` backup names cannot make saving Database Connector settings fail. Version 1.1.3 lets the successful settings POST return its normal HTTP 303 redirect instead of incorrectly handling it as an internal error.

Plugin setup
-----------
Expand All @@ -20,7 +16,13 @@ Plugin setup
If checked enabled plugin is enabled. When the box is checked, the extension will be active. After filling in all the fields, ospy must be restarted!

* Use buffer:
When enabled, database commands are saved in a local queue and processed in order. If the database connection is unavailable, commands remain queued and are saved after the connection is restored. This helps prevent data loss from logging in other plugins. The queue is stored in SQLite in the plug-in data directory and survives OSPy restarts. The page displays the number of queued commands and lets the administrator clear the queue manually. Clearing permanently discards every queued command. Disabling the buffer stops background replay and sends new commands through the direct database path.
When enabled, database commands are saved in a local SQLite queue and processed in order. If the database connection is unavailable, commands remain queued and are saved after the connection is restored. The queue records the time that the original database command was submitted; during replay the connector sets the MySQL/MariaDB session timestamp to that saved value, so `CURRENT_TIMESTAMP` and timestamp defaults keep the original logging time. The queue survives OSPy restarts. The page displays its command count and used size, and lets the administrator clear it manually. Clearing permanently discards every queued command. Disabling the buffer stops background replay and sends new commands through the direct database path.

* Queue warning size and maximum size:
The warning threshold defaults to 80 MiB and the maximum defaults to 100 MiB. Both values are adjustable, and the warning must be smaller than the maximum. The connector sends one alert after crossing the warning threshold and re-arms it after the queue shrinks below the threshold. It does not evict older records: when a new command would exceed the maximum, it is rejected and a separate one-time limit alert is sent. This protects the SD card while retaining the oldest pending records in FIFO order.

* Send queue alert e-mail through SSL and Queue alert e-mail subject:
Enable this only when the E-mail Notifications SSL plug-in is configured. Queue alerts use that plug-in's SMTP-over-SSL settings and recipients; this plug-in stores no SMTP password. The configured subject is used as the prefix for both the warning and maximum-size messages.

* Host:
IP address to the database server.
Expand Down
Loading
Loading