diff --git a/source/_integrations/sql.markdown b/source/_integrations/sql.markdown index e024137e5dc..8dbde56f5ca 100644 --- a/source/_integrations/sql.markdown +++ b/source/_integrations/sql.markdown @@ -17,7 +17,7 @@ This can be used to present statistics about Home Assistant sensors if used with To configure this sensor, you need to define the sensor connection variables and a list of queries to your `configuration.yaml` file. A sensor will be created for each query: -To enable it, add the following lines to your `configuration.yaml`: +To enable it, add the following lines to your `configuration.yaml` file: {% raw %} ```yaml @@ -109,7 +109,7 @@ SELECT * FROM states WHERE entity_id = 'binary_sensor.xyz789' GROUP BY state ORD ### Database size -#### Database size in Postgres +#### Postgres {% raw %} ```yaml @@ -140,3 +140,19 @@ sensor: unit_of_measurement: kB ``` {% endraw %} + +#### SQLite + +If you are using the `recorder` integration then you don't need to specify the location of the database. For all other cases, add `db_url: sqlite:////path/to/database.db`. + +{% raw %} +```yaml +sensor: + - platform: sql + queries: + - name: DB Size + query: 'SELECT ROUND(page_count * page_size / 1024 / 1024, 1) as size FROM pragma_page_count(), pragma_page_size();' + column: 'size' + unit_of_measurement: 'MiB' +``` +{% endraw %}