本帖最后由 jyz_0501 于 2020-3-9 04:10 编辑
家里有两个车库(忽略...忽略...),想做到对车库门进行监控,如果车库中或者车库外有安装了摄像头的话,也可以通过客户端推送视频和图片。 如果只有一个车库门的话,实际没这么麻烦。
推送的IOS客户端的声音中使用了template,这样可以推送两种不同的声音,车库门打开的时候,推送opened声音,关闭的时候推送的closed的声音。
- id: 1bc9067bd15d4760bf4ccd5290ae93c9
alias: 车库状态变化通知
trigger:
- event_data: {}
event_type: state_changed
platform: event
condition:
- condition: template
value_template: '{{ trigger.event.data.new_state.state != trigger.event.data.old_state.state
}}'
- condition: template
value_template: '{{ trigger.event.data.new_state.state == "closed" or trigger.event.data.new_state.state
== "open" }}'
- condition: template
value_template: '{{ trigger.event.data.entity_id.split(".")[0] == "cover"}}'
action:
- data_template:
data:
push:
badge: 1
category: alarm
sound: '{% if trigger.event.data.new_state.state == "closed" %}Garage has
been closed.wav{% elif trigger.event.data.new_state.state == "open" %}Garage
has been opened.wav{% endif %}'
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 %}'
title: 安防通知
service: notify.notify
|