本帖最后由 dscao 于 2021-2-10 15:10 编辑
没发现这个问题,也不应该有这个问题。默认的就是“condition: and”,不需要特别加这个的,除非还有其它很多条件组合。
下面这个我正在用的自动化,执行情况都是良好的。
alias: 餐厅夜间自动开灯关灯
description: ''
trigger:
- entity_id: binary_sensor.0x158d000636a1ec_motion
platform: state
to: 'on'
condition:
- condition: state #关灯状态,手动打开的就不会触发此自动化
entity_id: light.hassmartcantingdeng
state: 'off'
- condition: or
conditions:
- condition: state #夜间
entity_id: sun.sun
state: below_horizon
- condition: numeric_state #白天光线暗的情况
entity_id: sensor.0x4cf8cdf3c78bee4_illuminance
below: '30'
action:
- service: light.turn_on
data: {}
entity_id: light.hassmartcantingdeng
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- repeat:
until:
- condition: state
entity_id: binary_sensor.0x158d000636a1ec_motion
state: 'off'
- condition: time
after: '20:00'
before: '18:00'
sequence:
- delay:
hours: 0
minutes: 1
seconds: 30
milliseconds: 0
- service: light.turn_off
data: {}
entity_id: light.hassmartcantingdeng
mode: single
|