mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-04 10:08:57 +00:00
1.6 KiB
1.6 KiB
layout, title, description, date, sidebar, comments, sharing, footer, ha_category
layout | title | description | date | sidebar | comments | sharing | footer | ha_category |
---|---|---|---|---|---|---|---|---|
page | Template Binary Sensor | Instructions how to integrate Template binary sensors into Home Assistant. | 2016-02-25 15:00 | true | false | true | true | Binary Sensor |
The template
platform supports sensors which breaks out the state and state_attributes
from other entities.
To enable Template sensors in your installation, add the following to your configuration.yaml
file:
# Example configuration.yaml entry
binary_sensor:
platform: template
sensors:
sun_up:
value_template: {% raw %}'{{ states.sun.sun.attributes.elevation > 0}}'{% endraw %}
friendly_name: 'Sun is up'
Configuration variables:
- sensors array (Required): List of your sensors.
- friendly_name (Optional): Name to use in the Frontend.
- sensor_class (Optional): The type/class of the sensor to set the icon in the frontend.
- value_template (Optional): Defines a template to extract a value from the payload.
{% linkable_title Examples %}
In this section you find some real life examples of how to use this sensor.
{% linkable_title Sensor threshold %}
This example indicates true if a sensor is above a given threshold. Assuming a sensor of furnace
that provides a current reading for the fan motor, we can determine if the furnace is running by checking that it is over some threshold:
sensor:
platform: template
sensors:
furnace_on:
value_template: {{ states.sensor.furnace.state > 2.5 }}
friendly_name: 'Furnace Running
sensor_class: heat