The Problem:
When v2.2.0 introduced zero-config auto-detection, the database scoring was hardcoded to measure the built-in SQLite file. Users running external databases (MariaDB, PostgreSQL) lost the ability to feed their database size into the health score, an oversight from the migration.
The Fix:
HAGHS now offers an optional Database Size Sensor field in both the Setup and Options flow. If you run an external database, simply point HAGHS to a sensor that reports your DB size in MB, the rest works exactly like before.
What changed
New: Optional "Database size sensor" field in Setup and Options UI
Behavior: When a sensor is configured, HAGHS reads its value (in MB) instead of measuring the local SQLite file. When left empty, the default SQLite auto-detection remains active, no change for existing users.
Migration: None required. Existing installations are completely unaffected by this update.
How to use (external DB users only)
- Create a sensor that reports your database size in MB (e.g., via the SQL integration)
- Go to Settings → Integrations → HAGHS → Configure
- Select your sensor in the "Database size sensor (optional)" field
- Save, changes apply immediately
Technical details
- Only _async_get_db_size_mb() was modified, the penalty calculation, thresholds, and dynamic limit formula are unchanged
- The field uses vol.Optional with no default, old config entries without the key automatically fall back to SQLite detection
- No ConfigFlow.VERSION bump needed (purely additive, no schema migration)