Added a CSV example (#19318)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
Pieter Rautenbach 2021-09-22 11:55:21 +02:00 committed by GitHub
parent 56e2a49d90
commit c854742525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,3 +115,30 @@ sensor:
```
{% endraw %}
#### Entries as CSV
Assuming the log file contains multiple values formatted as CSV like shown below:
```text
timestamp,temperature,humidity
1631472948,21,39
1631472949,22,36
```
This would require the following entry in the `configuration.yaml` file to extract the temperature:
{% raw %}
```yaml
# Example configuration.yaml entry
sensor:
- platform: file
name: Temperature
file_path: /home/user/.homeassistant/sensor.csv
value_template: '{{ value.split(",")[1] }}'
unit_of_measurement: "°C"
```
{% endraw %}