本帖最后由 jyz_0501 于 2019-5-20 19:04 编辑
方法还是老方法,好像是L大的一篇开关状态通知的帖子,举一反三,cover light什么的都可以 遍历一下就可以
感谢囧大排错。
- alias: 车库状态变化通知
trigger:
- platform: event
event_type: state_changed
condition:
- condition: time
after: '07:59:00'
before: '23:00:00'
- condition: template
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'cover' }}"
- condition: template
value_template: "{{ trigger.event.data.new_state.state != trigger.event.data.old_state.state }}"
action:
- service: hello_miai.force_send
data_template:
message: >
{% if trigger.event.data.new_state.state == "closed" %}
{{ trigger.event.data.new_state.attributes.friendly_name }}已经关上。
{% elif trigger.event.data.new_state.state == "open" %}
{{ trigger.event.data.new_state.attributes.friendly_name }}被打开。
{% endif %}
复制代码