可以参考一下
##早晚开关窗帘
- alias: win_toggle
initial_state: true
trigger:
platform: state
entity_id: sensor.sun_state #日出日落
condition:
#窗户关闭状态,可以不加
condition: state
entity_id: binary_sensor.door_window_sensor_158d0000d6b39d
state: 'off'
action:
- service_template: >
{% if trigger.to_state.state == '日出' %}
cover.open_cover
{% else %}
cover.close_cover
{% endif %}
entity_id: cover.window
|