|
发表于 2018-8-27 20:19:42
|
显示全部楼层
sensor:
- platform: template
sensors:
people_home_count:
entity_id:
- device_tracker.person_1
- device_tracker.person_2
- device_tracker.person_3
value_template: >-
{% set count = 0 %}
{% if is_state("device_tracker.person_1", "home") %}
{% set count = count + 1 %}
{% endif %}
{% if is_state("device_tracker.person_2", "home") %}
{% set count = count + 1 %}
{% endif %}
{% if is_state("device_tracker.person_3", "home") %}
{% set count = count + 1 %}
{% endif %}
{{count}} |
|