本帖最后由 windgo 于 2019-3-21 09:32 编辑
下面是一個偵測到BLE裝置後自動開門的範例sensor.mible是MQTT sensor,接收ESP32送來的數值(平常是checking,偵測到BLE裝置後會狀態變windgo)
- id: '1528249065037'
alias: bt_windgo
trigger:
- entity_id: sensor.mible
from: checking
platform: state
to: windgo
condition:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d000123129f
state: 'off'
- condition: state
entity_id: switch.doorlock
state: 'off'
- condition: state
entity_id: binary_sensor.door_window_sensor_158d0001f342fb
state: 'off'
action:
- data:
entity_id: switch.doorlock
service: switch.turn_on
- data:
message: 宗翰到門口了
title: 開鎖通知
service: notify.ios_doris_iphone
- data:
message: 已為你開門
title: 開鎖通知
service: notify.windgo8
- data:
message: 宗翰到門口了
miai_num: 1
service: hello_miai.send
- data:
entity_id: automation.bt_doris
service: automation.turn_off
- data:
entity_id: automation.bt_windgo
service: automation.turn_off
- delay: '20'
- data:
message: 歡迎宗翰回來
miai_num: 1
service: hello_miai.send
|