Use modern template binary-sensor in example (#20029)

This commit is contained in:
Chen-IL 2021-10-28 22:27:54 +03:00 committed by GitHub
parent 330298aba3
commit 35884cda86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,17 +158,16 @@ conjunction with a `Template Binary Sensor`. The following example does that.
{% raw %}
```yaml
binary_sensor:
- platform: template
sensors:
motion_battery_low:
value_template: "{{ state_attr('sensor.motion', 'battery') < 15 }}"
friendly_name: "Motion battery is low"
template:
- binary_sensor:
- name: "Motion Battery is Low"
state: "{{ state_attr('sensor.motion', 'battery') | float(default=0) < 15 }}"
device_class: battery
alert:
motion_battery:
name: Motion Battery is Low
entity_id: binary_sensor.motion_battery_low
entity_id: binary_sensor.motion_battery_is_low
repeat: 30
notifiers:
- ryans_phone