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 %} {% raw %}
```yaml ```yaml
binary_sensor: template:
- platform: template - binary_sensor:
sensors: - name: "Motion Battery is Low"
motion_battery_low: state: "{{ state_attr('sensor.motion', 'battery') | float(default=0) < 15 }}"
value_template: "{{ state_attr('sensor.motion', 'battery') < 15 }}" device_class: battery
friendly_name: "Motion battery is low"
alert: alert:
motion_battery: motion_battery:
name: Motion Battery is Low name: Motion Battery is Low
entity_id: binary_sensor.motion_battery_low entity_id: binary_sensor.motion_battery_is_low
repeat: 30 repeat: 30
notifiers: notifiers:
- ryans_phone - ryans_phone