本帖最后由 情非殇 于 2018-12-28 16:10 编辑
automation:
- alias: test01
## 树莓派上电(HA已自动启动)
trigger:
platform: homeassistant
event: start
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.zhamen1
state: 'on'
- condition: numeric_state
entity_id: counter.my_custom_counter
above: 2
action:
- service: counter.reset
- service: counter.increment
## 延时10分钟(等待家中的设备全部联网)
- delay: 00:10:00
## 重启HA
- service: homeassistant.restart
- alias: test02
## HA第二次重启
trigger:
platform: homeassistant
event: start
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.zhamen1
state: 'on'
- condition: state
entity_id: counter.my_custom_counter
state: '2'
action:
## 打开所有灯和开关
- service: light.turn_on
- service: switch.turn_on
## 延时1分钟
- delay: 00:01:00
## 关闭所有的灯和开关
- service: light.turn_off
- service: switch.turn_off
## 此闸门拉上on时,上面自动化生效,
## 此闸门拉下off时,自动化失效,用于自己手动重启ha的情景
input_boolean:
zhamen1:
name: 保险拉闸
initial: on
## 计数器
counter:
my_custom_counter:
initial: 0
step: 2
restore: true
|