Add entity_id example combining multiple sensors (#876)

* Add entity_id example combining multiple sensors

* Add raw/end raw to template
This commit is contained in:
Greg Dowling 2016-08-31 20:08:23 +01:00 committed by Fabian Affolter
parent 4570ed9e57
commit 0cb995e1db

View File

@ -66,3 +66,29 @@ binary_sensor:
value_template: {% raw %}"{{ states.switch.door.state == 'on' }}"{% endraw %} value_template: {% raw %}"{{ states.switch.door.state == 'on' }}"{% endraw %}
sensor_class: opening sensor_class: opening
``` ```
### {% linkable_title Combining multiple sensors, and using entity_id: %}
This example combines multiple CO sensors into a single overall status. It also shows how to use `entity_id`
```yaml
binary_sensor:
- platform: template
sensors:
co:
friendly_name: 'CO'
sensor_class: 'gas'
value_template: {% raw %}>-
{%- if is_state("sensor.bedroom_co_status", "Ok")
and is_state("sensor.kitchen_co_status", "Ok")
and is_state("sensor.wardrobe_co_status", "Ok") -%}
Off
{%- else -%}
On
{%- endif %}{% endraw %}
entity_id:
- sensor.bedroom_co_status
- sensor.kitchen_co_status
- sensor.wardrobe_co_status
```