- platform: template
sensors:
garage_door_status:
friendly_name: "车库门状态"
value_template: >-
{% if is_state('binary_sensor.sonoff_1001d8ac3f', 'on') %}
{% if as_timestamp(now()) - as_timestamp(states.binary_sensor.sonoff_1001d8ac3f.last_changed) >= 5 %}
open
{% else %}
Open
{% endif %}
{% else %}
{% if is_state('binary_sensor.sonoff_1001d8ac3f', 'off') %}
{% if as_timestamp(now()) - as_timestamp(states.binary_sensor.sonoff_1001d8ac3f.last_changed) >= 5 %}
Closed
{% else %}
Closing
{% endif %}
{% endif %}
{% endif %}
不太完美,求解答,反馈比较慢
|