mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 08:16:53 +00:00
parent
3f33e14c32
commit
93312671e9
@ -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 %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user