mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 13:26:54 +00:00
Added a CSV example (#19318)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
parent
56e2a49d90
commit
c854742525
@ -115,3 +115,30 @@ sensor:
|
|||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% 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 %}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user