mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
Updated documentation for template binary_sensor (#9106)
* Updated documentation for template binary_sensor * Update binary_sensor.template.markdown * Updated section header
This commit is contained in:
parent
60922d12dc
commit
ef860a6255
@ -66,6 +66,15 @@ sensors:
|
|||||||
description: Defines a template for the entity picture of the sensor.
|
description: Defines a template for the entity picture of the sensor.
|
||||||
required: false
|
required: false
|
||||||
type: template
|
type: template
|
||||||
|
attribute_templates:
|
||||||
|
description: Defines templates for attributes of the sensor.
|
||||||
|
required: false
|
||||||
|
type: map
|
||||||
|
keys:
|
||||||
|
"attribute: template":
|
||||||
|
description: The attribute and corresponding template.
|
||||||
|
required: true
|
||||||
|
type: template
|
||||||
delay_on:
|
delay_on:
|
||||||
description: The amount of time the template state must be ***met*** before this sensor will switch to `on`.
|
description: The amount of time the template state must be ***met*** before this sensor will switch to `on`.
|
||||||
required: false
|
required: false
|
||||||
@ -210,6 +219,35 @@ binary_sensor:
|
|||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
### Device Tracker sensor with Latitude and Longitude Attributes
|
||||||
|
|
||||||
|
This example shows how to combine an non-GPS (e.g. NMAP) and GPS device tracker while still including latitude and longitude attributes
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
```yaml
|
||||||
|
binary_sensor:
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
my_device:
|
||||||
|
value_template: >-
|
||||||
|
{{ is_state('device_tracker.my_device_nmap','home') or is_state('device_tracker.my_device_gps','home') }}
|
||||||
|
device_class: 'presence'
|
||||||
|
attribute_templates:
|
||||||
|
latitude: >-
|
||||||
|
{% if is_state('device_tracker.my_device_nmap','home') %}
|
||||||
|
{{ state_attr('zone.home','latitude') }}
|
||||||
|
{% else %}
|
||||||
|
{{ state_attr('device_tracker.my_device_gps','latitude') }}
|
||||||
|
{% endif %}
|
||||||
|
longitude: >-
|
||||||
|
{% if is_state('device_tracker.my_device_nmap','home') %}
|
||||||
|
{{ state_attr('zone.home','longitude') }}
|
||||||
|
{% else %}
|
||||||
|
{{ state_attr('device_tracker.my_device_gps','longitude') }}
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
### Change the icon when state changes
|
### Change the icon when state changes
|
||||||
|
|
||||||
This example demonstrates how to use `icon_template` to change the entity's
|
This example demonstrates how to use `icon_template` to change the entity's
|
||||||
|
Loading…
x
Reference in New Issue
Block a user