Add detail for text file

This commit is contained in:
Fabian Affolter 2016-06-20 23:46:11 +02:00
parent f3459e1f81
commit f057ec3ceb

View File

@ -82,6 +82,16 @@ You can see directly in the frontend (**Developer tools** -> **About**) what rel
name: HA release
```
### {% linkable_title Read value out of a remote text file %}
If you own a devices which are storing values in text files which are accessible over HTTP then you can use the same approach as shown in the previous section. Instead of looking at the JSON response we directly grab the sensor's value.
```yaml
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://remote-host/sensor_data.txt').text)"
name: File value
```
### {% linkable_title Use an external script %}
The example is doing the same as the [aREST sensor](/components/sensor.arest/) but with an external Python script. It should give you an idea about interacting with devices which are exposing a RESTful API.