Add an example template to extract air quality (#18869)

* Add an example template to extract air quality 

Thought it would be helpful to add a example template showing how to extract air quality and capitalise the results. 

This is my first PR for this project so I apologise if I've made any mistakes

* Use new template format & changed to state_attr()

* Tweaks

* Tweak

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Cameron Smith 2021-08-09 21:43:55 +01:00 committed by GitHub
parent 267d20d903
commit 38fa3122ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,5 +126,17 @@ sensor:
value_template: '{{ states.switch.vesync_switch.attributes["voltage"] | float }}'
unit_of_measurement: "V"
```
{% endraw %}
Extracting air quality from a VeSync LV-PUR131S air purifier. Change the `vesync_air_purifier` to match your device's entity ID.
{% raw %}
```yaml
template:
- sensor:
- name: "VeSync Air Quality"
state: "{{ state_attr('fan.vesync_air_purifier', 'air_quality') | title }}"
```
{% endraw %}