When I try to execute a query to get the HA database size using the SQL sensor against my SQLLite database that is running in memory, the query returns 0 (zero).
In the SQL sensor definition I use the same URL that I’m using in the Recorder. If I omit this query URL then the query is executed against the “home-assistant_v2.db” in the …/homeassistant directory and the same value is returned as when I execute the query when I connect to this database directly (using: sqlite3 home-assistant_v2.db), which suggests that the rest of the sensor configuration is fine.
Below: the Recorder database definition in configuration.yaml:
recorder: db_url: 'sqlite:///:memory:'
And the SQL sensor definition:
sensor: - platform: sql db_url: 'sqlite:///:memory:' queries: query: "SELECT ROUND(page_count * page_size / 1024 / 1024, 1) as size FROM pragma_page_count(), pragma_page_size();" column: "size" unit_of_measurement: MB
I don’t get any error in the logs, so not sure what I’m doing wrong.
Any ideas how to get this to work?