本帖最后由 Yonsm 于 2019-8-6 11:37 编辑
Jones 发表于 2019-8-6 10:21
不是一般的厉害,那是相当厉害!不知道有没有定时功能,直接加个简单的定时开关功能也好啊 ...
定时功能期望是怎么样的,你说说看。按我的理解 HA Automation 本身就支持定时功能了,比如:
1. 定在某个时间自动执行:
- alias: Passage Light Reaction Enabler
trigger:
- platform: time
at: '07:00:00'
action:
2. 每隔3分钟周期性定时执行:
- alias: Washroom Light Off
trigger:
- platform: time_pattern
minutes: '/3'
condition:
- condition: state
entity_id: binary_sensor.motion_sensor_158d0001f4a238
state: 'off'
action:
- service: light.turn_off
entity_id: light.washroom_light
- service: automation.turn_off
entity_id: automation.washroom_light_off
3. 定在自动化开启后的一分钟后执行:
- alias: 一分钟后执行
initial_state: false
trigger:
- platform: state
entity_id: automation.yi_fen_zhong_hou_zhi_xing
from: 'off'
to: 'on'
action:
- delay: '00:01:00'
- service: logbook.log
data:
name: 现在是一分钟后
message: 我已经被执行了哈
- service: automation.turn_off
entity_id: automation.yi_fen_zhong_hou_zhi_xing
|