Corrected indentation and standardized examples (#8130)

This commit is contained in:
Marat Levit 2019-01-12 07:04:25 +11:00 committed by Fabian Affolter
parent b39b9db770
commit 0b684012e2

View File

@ -107,7 +107,7 @@ Note that the SQL sensor state corresponds to the last row of the SQL result set
This example only works with *binary_sensors*: This example only works with *binary_sensors*:
```sql ```sql
SELECT * FROM states WHERE entity_id='binary_sensor.xyz789' GROUP BY state ORDER BY last_changed DESC LIMIT 1; SELECT * FROM states WHERE entity_id = 'binary_sensor.xyz789' GROUP BY state ORDER BY last_changed DESC LIMIT 1;
``` ```
### {% linkable_title Database size %} ### {% linkable_title Database size %}
@ -116,7 +116,8 @@ SELECT * FROM states WHERE entity_id='binary_sensor.xyz789' GROUP BY state ORDER
{% raw %} {% raw %}
```yaml ```yaml
- platform: sql sensor:
- platform: sql
db_url: postgresql://user:password@host/dbname db_url: postgresql://user:password@host/dbname
queries: queries:
- name: DB size - name: DB size
@ -131,12 +132,12 @@ SELECT * FROM states WHERE entity_id='binary_sensor.xyz789' GROUP BY state ORDER
{% raw %} {% raw %}
```yaml ```yaml
sensor: sensor:
- platform: sql - platform: sql
db_url: mysql://user:password@localhost/hass db_url: mysql://user:password@localhost/hass
queries: queries:
- name: DB size - name: DB size
query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1024, 1) "value" FROM information_schema.tables WHERE table_schema="hass" GROUP BY table_schema;' query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1024, 1) "value" FROM information_schema.tables WHERE table_schema="hass" GROUP BY table_schema;'
column: 'value' column: 'value'
unit_of_measurement: kB unit_of_measurement: kB
``` ```
{% endraw %} {% endraw %}