本帖最后由 jyz_0501 于 2018-8-5 21:03 编辑
- alias: openlight
initial_state: true
# hide_entity: false
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d000XXXXX
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.motion_sensor_158d0001dXXXXX
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.illumination_7811dcbXXXXX
below: 650
- condition: state
entity_id: light.livingroomlight_2
state: 'off'
#判断家中无人的时间(约20多分钟)
- condition: template
value_template: '{{states.binary_sensor.motion_sensor_158d0001dXXXXX.attributes["No motion since"] | int >= 600}}'
action:
- service: light.turn_on
entity_id: light.livingroomlight_2
- service: tts.baidu_say
data_template:
entity_id: media_player.kodi,media_player.mpd
message: >
"欢迎回家,天已变暗,自动为您开灯。"
cache: false
整个自动化是由入户门的门磁和进门后的人体传感器同时满足来触发,同时满足小米网关灯的室内亮度低于650,迎宾灯是关着的,而且人体传感器触发时间超过600秒 就打开迎宾灯,同时tts 。
问题: 判断是从家里出去 还是从外面进来不太好判断, 另外无论 No motion since 设置时间再小,总是触发一次 就不再触发了,这是为什么呢???
|