本帖最后由 metoo 于 2017-11-28 19:33 编辑
之前用的domoticz,自动化相对来说比较简单
但是hass界面好看啊
最近研究了一段时间,想实现以下效果
有人时而且亮度低则开灯,亮度高关灯,亮度低人还在则开灯.人走后15秒关灯
前面3条都实现了,就是最后一条还不完美.
最后一条目前已知的问题有:
人走了15秒内又回来,灯还是15秒关闭.
已经结局,感谢管理员,代码在7楼
#玄关人体感应灯
- alias: auto_xuanguan_light_1
initial_state: true
hide_entity: true
trigger:
- platform: state
entity_id: binary_sensor.xuanguanpir
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.ketinglux
below: 5
- condition: state
entity_id: switch.sonoffxuanguan
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.sonoffxuanguan
- alias: auto_xuanguan_light_on_2
initial_state: true
hide_entity: true
trigger:
- platform: numeric_state
entity_id: sensor.ketinglux
below: 5
condition:
condition: and
conditions:
- condition: state
entity_id: switch.sonoffxuanguan
state: 'off'
- condition: state
entity_id: binary_sensor.xuanguanpir
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.sonoffxuanguan
- alias: auto_xuanguan_light_off_1
initial_state: true
hide_entity: true
trigger:
- platform: state
entity_id: binary_sensor.xuanguanpir
from: 'on'
to: 'off'
condition:
condition: and
conditions:
- condition: state
entity_id: switch.sonoffxuanguan
state: 'on'
- condition: state
entity_id: binary_sensor.xuanguanpir
state: 'off'
action:
- delay:
seconds: 15
- service: switch.turn_off
entity_id: switch.sonoffxuanguan
- alias: auto_xuanguan_light_off_2
initial_state: true
hide_entity: true
trigger:
- platform: numeric_state
entity_id: sensor.ketinglux
above: 10
condition:
- condition: state
entity_id: switch.sonoffxuanguan
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.sonoffxuanguan
|