本帖最后由 dgmax 于 2018-8-15 22:11 编辑
请忽略图片的质量。
本来就2个感应器可以实现的功能,就想放在HASS自动化里装高大上。
1,人要出去经过人体感应器[color=var(--primary-color)]binary_sensor.pir后灯2亮起,过5秒灯1亮起,等到门磁[color=var(--primary-color)]binary_sensor.1fdoor开合(人体感应2分钟内没人)后1分钟关掉2个灯。
2,人进来开关门磁打开灯1,5秒后灯2打开,等到人体检测(门磁没再开合)后1分钟关掉2个灯
3, 求这个template的详细说明,英文不会,在官方网看不明白 - condition: template
value_template: '{{ ( as_timestamp(states.binary_sensor.motion_sensor_158d0001d6676a.last_changed) - as_timestamp(states.binary_sensor.motion_sensor_158d000171ba5d.last_changed)) | int > 0 }}'
4,光照度从SONOFF上传到HASS很慢,基本要一分钟以上,来回要2分钟,光照貌似应用不上。
- alias: sl1 on
initial_state: true ##在你重启HA的时候这个自动化是开启(true)还是关闭(false)
hide_entity: true #隐藏自动化
trigger:
- platform: state
entity_id: binary_sensor.pir
to: 'on'
- platform: state
entity_id: binary_sensor.1fdoor
to: 'on'
condition:
condition: state
entity_id: light.sl1
state: 'off'
action:
service: light.turn_on
entity_id: light.sl1
- alias: sl1 off
initial_state: true ##在你重启HA的时候这个自动化是开启(true)还是关闭(false)
hide_entity: true #隐藏自动化
trigger:
platform: state
entity_id: light.sl1
to: 'on'
condition:
condition: or
conditions:
- condition: state
entity_id: binary_sensor.pir
state: 'off'
for:
minutes: 2
- condition: state
entity_id: binary_sensor.1fdoor
state: 'off'
for:
minutes: 2
action:
service: light.turn_off
entity_id: light.sl1
目前只会会这样写,手动开了灯也会强制关闭的。求优化
|